Displaying 20 results from an estimated 5000 matches similar to: "export variable from bash to R"
2010 Nov 02
2
get the scripname within the executed myscript.r
Dear R-users!
Is there a way to obtain the name of the executed myscript.r, i.e. when
cmd> rscript myscript.r
is executed? (The name of the script in this case is "myscript.r")
Here is the explanation of why I would like to get that: Why: I have
prepared a set of scripts (decompose_data.r, plot_with_higher_resolution.r,
plot_3D.r, etc.) placed in a root directory at one place. I
2012 May 22
2
Best way to locate R executable from within R?
Hi,
I'd like to spawn of a new R process from within R using system(),
e.g. system("R -f myScript.R"). However, just specifying "R" as in
that example is not guaranteed to work, because "R" may not be on the
OS's search path.
What is the best way, from within a running R, to infer the command
(basename or full path) for launching R in way that it works on
2005 Feb 25
3
passing command line arguments to 'R CMD BATCH myScript.R'
Hi Community,
I have a question about how to pass command line parameters to R script
running in the batch mode. The problem is: there is a banch of data
files which are to be processed by R script called from a web-server,
i.e. in the batch mode. The web server generates data files and passes
their names calling 'R CMD BATCH' one by one for every file. Now the
question is how to
2018 Sep 28
4
Simple bash question
I am calling a bash script and passing in somestring that includes a "$"
myscript "$plusmore"
I want to assign in the myscript the $1 arg to something like
MYTEXT="$1"
when I do that I dont get what I'm expecting. if I do
MYTEXT='$1'
I still dont get what I'm expecting.
On the first assignment of MYTEXT I do not want the "$" to be
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)
2013 Oct 21
4
About integrating R inside a C++ software
Hi,
We are a company developing a software mainly in C++.
We want to integrate R inside our software in order to use mainly the
engine (usual stats as mean, sigma, Pearson, outlier detection, CPA,
multivariate, ...) and probably later the chart solution.
Of course we don''t want to temporary write the data to some csv files
and then do an ugly system() call :
2013 Oct 21
4
About integrating R inside a C++ software
Hi,
We are a company developing a software mainly in C++.
We want to integrate R inside our software in order to use mainly the
engine (usual stats as mean, sigma, Pearson, outlier detection, CPA,
multivariate, ...) and probably later the chart solution.
Of course we don''t want to temporary write the data to some csv files
and then do an ugly system() call :
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,
2010 Jul 21
3
Problem with invoking R from the command line (Windows Vista)
Dear all
I am running in a problem when trying to run R from Windows command line.
I am runnning Windows Vista, R-2.10.1.
I have a script I would like to run remotely from another program. As it did
not work, I thought I would test the script from the Windows command line
which highlighted a problem.
When I open the command line and type R at the prompt (or any other variant
(R CMD BATCH,
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
2008 Mar 11
1
R-console vs. bash console (execution halted)
Dear Everyone,
I am using R 2.6.2 on my Redhat AS4. I installed the RPM offered on the cran website. I would like to use R from my bash console with the following command:
/path/to/R --vanilla --slave --args < /data/myscript.R
this script invokes a range of functions and tools, among others to process a bunch of raster images in a loop using GDAL. The thing is that releasing this command in
2001 Oct 08
1
Yet another batch mode question
Hello all and thanks in advance,
I know you can start R with either:
1. R CMD BATCH myfile.R
or
2. R < myfile.R
My question is this: what if I want multiple input files and/or command
line arguments. For example, under unix you can run a script command (in
a shell language, perl, or python) like:
python myScript.py
or better yet, if you have things set up right, you can place a
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
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
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 Aug 24
1
How to provide argument when opening RGui from an external application
Dear R-users,
I have written a small application (in visual basic) that automatically
generate some R scripts. I would like to execute these scripts when my
application is being closed.
My problem is that I don't know how to pass the
'source(c:/.../myscript.r)' instruction when I programmatically start
RGui. Tinn-R is capable of doing such things, so I guess there must be a
way
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))
}
2007 Mar 20
2
run a script during R CMD build
I would like R CMD build to run some R code which does some stuff and save the result as a file in /inst/docs folder.
Is there any way of doing this.
Thank you.
Johan
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love
[[alternative HTML version deleted]]