in reply to Re: Passing parameters to R script
in thread Passing parameters to R script
This creates the image file image.png which contains a plot of an exponential curve =) The variable Args contains the following:# test.R # Parse and use command line arguments # Invoke % R --slave --args 100 < test.R Args <- commandArgs(); # retrieve args x <- c(1:as.real(Args[4])); # get the 4th argument y <- c(x^2); # work out square png(filename="image.png"); # create image file plot(x,y); # plot image
We only require the 4th element for our graph. You can add more arguments and just pick them off accordingly =) I hope someone else finds this useful.[1] "/usr/lib/R/bin/exec/R" [2] "--slave" [3] "--args" [4] "100"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Passing parameters to R script
by Anonymous Monk on Apr 22, 2009 at 14:37 UTC | |
|
Re^3: Passing parameters to R script
by Anonymous Monk on Jun 08, 2010 at 09:39 UTC | |
by Anonymous Monk on Jan 09, 2011 at 14:28 UTC | |
by Anonymous Monk on Jan 06, 2011 at 03:53 UTC | |
|
Re^3: Passing parameters to R script
by Anonymous Monk on Feb 01, 2012 at 19:25 UTC |