Displaying 20 results from an estimated 5000 matches similar to: "Rscript on Windows"
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
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)
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.
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)
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,
2009 Aug 05
1
exec subdirectory of a package
Hello,
WRE contains the following information about the "exec" subdirectory of
a package :
"Subdirectory exec could contain additional executables the package
needs, typically scripts for interpreters such as the shell, Perl, or
Tcl. This mechanism is currently used only by a very few packages, and
still experimental."
I think it would be useful to expand "very
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
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 Apr 13
4
#!/usr/bin/env Rscript --vanilla ??
I think that's my first true question (rather than answer)
to R-help.
As R has, for a long time, become my primary scripting and
programming language, I'm prefering at times to write Rscript
files instead of shell scripts, notably when R has nice ways to
do some of the things.
On a standard standalone platform with standard R,
I would start such a script with
2012 Oct 18
1
good documentation on use of Rscript. where to find?
What is the correct format for the shebang line and what options are
allowed or necessary along with this?
I find plenty of blogs and opinions, but few authoritative answers.
I want an R script to run and update packages periodically, with a
cron job that launches it. What is necessary to put in
line one of the R program. Aside from the basic part
#!/usr/bin/Rscript
what else can there be, or
2008 Jan 09
1
Rscript on OSX
Hi,
I directed somebody to install R (2.6.1) on his OSX computer,
following instructions from http://cran.r-project.org/bin/macosx.
She can run R from the console.
But plot(1:10) doesn't produce any output or open a window (as I am
used to from linux).
More importantly:
Rscript is not in the path (minor problem ln -s is hopefully doable). I tried
to put a hardcoded path to Rscript into the
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?
2012 Sep 21
1
__FILE__ object in R
Hi -
I'm curious if there is a way to get access to the location of the calling
script within R. I found one way of accessing it from this thread,
https://stat.ethz.ch/pipermail/r-devel/2008-April/048914.html, which
recommends using either:
parent.frame(2)$ofile
Or
FILE <- (function() {
attr(body(sys.function()), "srcfile")
})()$filename
However, those suggestions only
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)
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 =
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.
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
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