narges_s at yahoo.com
2012-Dec-03 16:44 UTC
[R] How to pass a vector of characters with Rscript through commandline
Hi, I have an R script and I want to it to accept a vector of characters as the input parameters in command line with the command Rscript. So for example I have this vector : each <- c("04","08","12","14") and I want to do this: Rscript script.R each How can I pass it? Thanks [[alternative HTML version deleted]]
MacQueen, Don
2012-Dec-03 20:39 UTC
[R] How to pass a vector of characters with Rscript through commandline
Use the commandArgs() function to get the parameters into R, then parse them. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 12/3/12 8:44 AM, "narges_s at yahoo.com" <narges_s at yahoo.com> wrote:>Hi, > >I have an R script and I want to it to accept a vector of characters as >the input parameters in command line with the command Rscript. >So for example I have this vector : each <- c("04","08","12","14") and I >want to do this: Rscript script.R each >How can I pass it? > >Thanks > [[alternative HTML version deleted]] >