[R] using var from bash in R script
dood
arulspam at gmail.com
Wed Jan 4 22:08:29 CET 2012
Dear R users,
This probably a really noob question, but I'm stuck. I'd like to pass some
variables from bash to R as strings. I can successfully pass variables using
commandArgs(), the problem is that I end up with an array. So, for example:
> Args <- commandArgs(TRUE)
> Args
[1] "one" "two" "three"
Now, it just so happens that "one", "two", "three" are names of columns that
I'd like to work with. I'd like to do something like this:
> print(summary(lm(Args[1] ~ Args[2])))
But, this doesn't work. The alternative would be to let bash write a number
of R-scripts and then rm them when done, but that seems like an unnecessary
step.
Can this be done?
Thanks
--
View this message in context: http://r.789695.n4.nabble.com/using-var-from-bash-in-R-script-tp4262857p4262857.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list