Hi,

For example, I have several variables in php, like

var1 = 1, 2, 3, 5, 6
var2 = 3, 1, 8
var3 = 8, 10, 4, 0, 9, 1

I sent the arguments to R, with this line:

'/usr/bin/R --vanilla --slave --args  '.$var1.' '.$var2.' '.$var3.' < script.r'

In my "script.r" I can read the arguments whit this line:

args=(commandArgs(TRUE))
args=as.numeric(args)

args = 1, 2, 3, 5, 6, 3, 1, 8, 8, 10, 4, 0, 9, 1

I'm looking the way to catch into de R, just the arguments var2

something like

args = 3, 1, 8

I know that is possible index with  

args[6:8]  

But, the problem is that the length of (var1, var2, var3) might be variable, 
not always var2 is args[6:8] 

Thanks in advance,

John

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to