similar to: Rscript -e does not accept newlines under Linux?

Displaying 20 results from an estimated 4000 matches similar to: "Rscript -e does not accept newlines under Linux?"

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?
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,
2008 Jan 05
1
Rscript argument processing minor bug with -g
I think there's a minor bug in the argument-processing carried out by Rscript. The effect is that if one passes "-g" as a flag to the script, it is erroneously exposed to the main executable's argument processing and therefore generates a message about not being able to comply with the request for a particular GUI. Uppercase G is fine as are the other 25 letters in upper or
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 Apr 30
2
Rscript.Rd example (PR#9644)
One of the examples in Rscript.Rd seems mis-formatted, in that the format statement is incomplete: ## Not run: Rscript -e 'date()' -e 'format(Sys.time(), " Both Rscript.Rd in R 2.5.0 and the version at: https://svn.r-project.org/R/trunk/src/library/utils/man/Rscript.Rd have Rscript -e 'date()' -e 'format(Sys.time(), "%a %b %d %X %Y")' Do
2012 Sep 06
1
[Rscript] difficulty passing named arguments from commandline
Wanting a commandline solution (for a problem detailed @ http://mailman.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2012/msg00279.html ) I turned to Rscript, and whacked out the q'n'd https://github.com/TomRoche/GEIA_to_netCDF/blob/master/netCDF.stats.to.stdout.r However it wasn't as quick as hoped, because I spent quite a bit of time figuring out how to pass the arguments.
2012 Oct 29
6
export variable from bash to R
Dear R experts This probably seems very easy to you guys, but I'm a beginner and would be really glad if someone helped me with this: I am trying to automate the execution of an R script (let's call it "myscript.R") by passing a variable from a bash script to myscript.R. I know I can use the command Rscript, but I don't know how to declare in bash which variable will be
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
2019 Feb 28
2
Exit status of Rscript
Current R release (3.5.2) and devel return a 0 exit status on error, while prior versions returned a non-zero exit status. On Linux and MacOs, the following line returns TRUE for R-3.5.2 and R-devel, and FALSE for R-3.5.1 and R-3.5.0: system2("Rscript", c("-e", shQuote("stop('foo')"))) == 0 I didn't find this in the NEWS, so I believe this is a bug.
2016 Oct 29
3
pasar argumentos de consola a un script de R que contiene source
Hola. Tengo un script con la siguiente estructura. #!/usr/bin/env Rscript args = commandArgs(trailingOnly=TRUE) source("carga-datos.R") source("modelo.R") y quiero llamar a mi script desde consola con Rscript --vanilla miscript.R datos1.csv De forma que se guarde como argumento el nombre del fichero que quiero cargar y se pase a al script carga-datos.R. El problema es
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
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
2013 Mar 09
1
Why cannot `Rscript -e` accept an empty line?
See the example below (under Ubuntu): $ Rscript -e '1' -e '2' [1] 1 [1] 2 $ Rscript -e '1' -e '' -e '2' ERROR: option '-e' requires an argument $ uname -a Linux xie 3.5.0-25-generic #39-Ubuntu SMP Mon Feb 25 18:26:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Similar problem under Windows: Rscript -e "1" -e "" -e "2" [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
2011 Apr 22
3
Parametrized object name in Save statement
Greetings All, I am looking to write a parametrized Rscript that will accept a variable name(that also is the name of the flat file), transform the data into a data frame and preform various modeling on the structure and save the output and plot of the model. In this example i am using a rpart decision tree. The only problem i am having is integrating the parameter into the internal object name
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