Displaying 20 results from an estimated 3000 matches similar to: "scan not working"
2009 May 09
2
need help with chisq
I am very new to R. I have some data from a CVS stored in vdata with 4
columns labeled:
X08, Y08, X09, Y09.
I have created two new "columns" like so:
Z08 <- (vdata$X08-vdata$Y08)
Z09 <- (vdata$X09-vdata$Y09)
I would like to use chisq.test for each "row" and output the p-value
for each in a stored variable. I don't know how to do it. Can you
help?
so far I have
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)
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,
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
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 =
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.
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
2013 Apr 03
1
Process substitution and read.table/scan
Hello, I did the same question on stackoverflow
(http://stackoverflow.com/questions/15784373/process-substitution) but
did not understand completely the issue so I'm reporting it here:
"
I've given a look around about what puzzles me and I only found this:
http://stackoverflow.com/questions/4274171/do-some-programs-not-accept-process-substitution-for-input-files
which is partially
2013 Apr 03
1
Process substitution and read.table/scan
Hello, I did the same question on stackoverflow
(http://stackoverflow.com/questions/15784373/process-substitution) but
did not understand completely the issue so I'm reporting it here:
"
I've given a look around about what puzzles me and I only found this:
http://stackoverflow.com/questions/4274171/do-some-programs-not-accept-process-substitution-for-input-files
which is partially
2008 Oct 15
1
Can R scripts executed in batch mode take a commandline argument?
I have examined the documentation for batch mode use of R:
R CMD BATCH [options] infile [outfile]
The documentation for this seems rather spartan.
Running "R CMD BATCH --help" gives me info on only two options: one for
getting help and the other to get the version. I see, further on, that
there are options for retoring and saving sessions (which I do not need to
do in this case),
2005 Sep 23
1
R's parsing of command line arguments using commandArgs()
Hi all,
I am setting up some R program files for use by our DB programmers to
enable them to utilize some R functions which will be called from within
TCL code. R has been installed on an RHEL server and R will process the
results of SQL queries against an Oracle database.
In some cases, they will generate a data file to be read in and
processed by R, in others they will simply make the
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