similar to: Rscript argument processing minor bug with -g

Displaying 20 results from an estimated 6000 matches similar to: "Rscript argument processing minor bug with -g"

2018 Sep 16
4
Rscript -e does not accept newlines under Linux?
Hello, I have found what I believe to be a bug in the Linux version of the Rscript binary. Under Windows (official 64-bit 3.5.1 R distribution running on an up-to-date Win10), I can do the following (e.g. under powershell): PS H:\Users\Cesko> Rscript -e 'ls() >> ls()' character(0) character(0) which works as I expect: I am running Rscript with two arguments, namely (1)
2007 Apr 01
2
commandArgs usage and --args invokation
Dear R experts: I am a bit stymied by how the argument picking-off works in R batch file usage. $ cat commandArgs.R cat(" Command Line Arguments were ", commandArgs(), "\n"); $ /usr/bin/R CMD BATCH commandArgs.R --args 1 2 3 $ /usr/bin/R --args 1 CMD BATCH commandArgs.R ... I am now getting into interactive mode ?! I guess it really is skipping the rest of the command line
2011 Mar 14
1
Rscript, hashbang, and arguments
Hi, I have a bunch of R scripts which have the hash bang !/usr/bin/env Rscript and I typically run these scripts by passing in some parameters like this: ./nameOfRScript arg1 arg2 ... I know Rscript has the option to run in --vanilla. Where exactly do I insert the --vanilla option? When I do something like this: ./nameOfRScript --vanilla arg1 arg2 ... And I try to access the commandArgs,
2024 Aug 23
1
Linear regression and stand deviation at the Linux command line
? Thu, 22 Aug 2024 13:07:37 -0600 Keith Christian <keith1christian at gmail.com> ?????: > I'm interested in R construct(s) to be entered at the command > line that would output slope, y-intercept, and r-squared values read > from a csv or other filename entered at the command line, and the same > for standard deviation calculations, namely the standard deviation, >
2009 Nov 10
1
Is it possible to detect whether running as Rscript?
I would like to write a block of code that runs when a script is being run from Rscript, but not to run if the same file is being source()d, or submitted via ESS, etc. As a gloss I would like to write a file that looks somewhat like: #!/usr/bin/env Rscript my.func <- function(...) { #do something... } if ( #is.running.Rscript# ) { do.call(my.func, commandArgs(trailingOnly=TRUE)) }
2009 Aug 20
1
Command line option to an R script running through Rscript
Hi, I know that I can use the following script to get the command line options for an R script. But the output shows two many irrelevant arguments. For example, I only want to pass "a", "b" and "c" to the script. The first 5 elements in the variable 'args' are not what I want. I am wondering what is the correct way to pass command line options to an R script.
2012 Mar 01
2
Rscript example
Hi there, I am trying to find an example how to use Rscript Let's suppose I want to pass 3 arguments (I don't want [options] and -e [expressions] as described in help) *on the command line myRscript.R -arg1=value1 -arg2=value2 -arg3=value3 *In the script #! /path/to/Rscript args = commandArgs(TRUE); >From what I see args is just a string, do I do things correctly ? -- View this
2007 Jan 24
1
writing R shell scripts?
Hi All, Another newbie question. I want to write an R script that takes argument from command line and runs and produces output to stdin. For example if there is file foo.R with following in it. args = commandArgs() print(args) then, when I run it like $ R foo.R hello it should print 'hello' on the terminal. I searched the mainling list and found a very old post that said said that
2018 Sep 17
0
Rscript -e does not accept newlines under Linux?
On 16/09/2018 4:53 AM, Voeten, C.C. wrote: > Hello, > > I have found what I believe to be a bug in the Linux version of the Rscript binary. > Under Windows (official 64-bit 3.5.1 R distribution running on an up-to-date Win10), I can do the following (e.g. under powershell): > > PS H:\Users\Cesko> Rscript -e 'ls() >>> ls()' > character(0) > character(0)
2014 Sep 18
1
last user argument missing from Rscript --verbose
The loop that echoes the arguments almost always stops too soon. It apparently does that to avoid echoing the "--args" (that had been inserted) when there are no user arguments. However, when there are user arguments, the next element of the 'av' array is the last argument and usually not "--args", although it can be. ?Rscript is a little sketchy: ?--verbose?
2013 Mar 24
0
Rscript does not load/capture all shell arguments
Hi, I am working on a GRASS script (bash script), which should run a R script. I am working on Ubuntu 12.10, with R 2.15.3 and GRASS GIS 7.0 (I am not sure the latter isn't really relevant as the grass script is just a bash script). The R script is evoked with a call to Rscript ($RGRASSSCRIPT is a shell variable with the file name of the R script, the rest are variables I want to read into R)
2009 Jun 18
1
Calling library functions from outside R
I develop quite a bit of R code that I tend to distribute, or let other people embed in their software. One of the things I'd really like to do is find a way to load an R library I've developed, and call one function with arguments. Currently, I achieve that by building a separate R client file, which reads in the command line arguments, loads the library, and calls the main
2012 May 03
1
is there a way of identifying batch mode running?
Hello list Is there a way of identifying from within R whether a script has been source(d) from Rgui.exe or via Rscript.exe in batch mode? For the code I have I use the commandArgs() function to pick up command line args when running in batch mode via Rscript.exe However I like to get the code working manually first using source("MyRCode.r") I'd like to be able to put something at
2012 Mar 28
2
getopt does not work as expected!
I have the following script (also attached): #!/usr/bin/Rscript spec=matrix(c( 'verbose', 'v', 1, "integer", 'help' , 'h', 0, "logical" ),ncol=4, byrow=TRUE) spec.dim=dim(spec) spec.opt.long=spec[,1] spec.opt.short=spec[,2] spec.opt.l <- spec.dim[1] infile <- "test.dat" args=commandArgs(TRUE); l=length(args) self =
2007 Jan 26
1
Rscript on Windows
On UNIX one can use #! notation. It would be nice to be able to do something similar on Windows. This could be done by giving Rscript the capability of skipping over the first few lines. For example, there might be a --skip=n argument or perhaps Rscript would skip over any consecutive leading lines that begin with @ in the R file since that cannot be syntactically correct R but does have
2007 Aug 27
1
R 2.5.1 - Rscript through tee
Hi, people. I met a little problem for which someone might have a solution. Let's say I have an executable file (named "pp.R") with this contents: #!/usr/bin/Rscript options(echo=TRUE) a <- 1 Sys.sleep(3) a <- 2 If I execute "./pp.R" at the shell prompt, the output shows the timely progress of the script as expected. If I use "./pp.R | tee
2010 Oct 14
1
Using Rscript to read from a file
Hello, I have this script which will be invoked as Rscript a.r < a.r a.r follows #!/usr/bin/Rscript --vanilla f=file("stdin") while(TRUE){ y=readLines(f,n=1,warn=TRUE) if(length(y)==0) break else print(y) } But it only reads one line from a.r How can I read line by line from standard input? Thank you Saptarshi
2009 Aug 28
1
How to convert a string passed as an argument to a vector?
Hi, $ cat commandArgs.R args=commandArgs(trailingOnly=TRUE) args[1]+10 I have the above code. But the following command line gives me an error. I am wondering what is the correct way to convert a string to a vector? $ Rscript commandArgs.R 1:3 > args=commandArgs(trailingOnly=TRUE) > args[1]+10 Error in args[1] + 10 : non-numeric argument to binary operator Execution halted Regards, Peng
2009 Jun 24
1
Rscript segfaults with lazy loading
Hi, I have an RData file containing a GeneSetCollection object (Bioconductor), http://www.cs.mu.oz.au/~gabraham/c2.RData. I think it uses lazy loading because packages are only loaded when I access the object (see below) in the R console. When I try the same with Rscript, it segfaults. This happens on 2.9.0 both on Linux and Mac: Rscript -e 'load("c2.RData"); c2[1]' ***
2008 Jul 01
4
passing a variable at the command line
Dear R People: I have used ./R --no-save -q -f e.in >stuff.out with great success on SUSE10.1 with R-2.7.1. My question is, please: is there a way to pass in a variable to the e.in file? I'm fairly sure that the answer is no, but thought I'd double check. Thanks in advance, Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences