[R] transfer R objects back to console/command line

Jannis bt_jannis at yahoo.de
Wed May 16 20:36:07 CEST 2012


Dear R community,


is there any way to invoke R in batch mode, do some calculations and get 
the values of some R variables back into the (bash)shell ? I only 
managed to get some output saved into a text file with:

  R --slave --args 2 2 <test.R>test2.R

test.R contains:

a <- as.numeric(commandArgs()[4])
b <- as.numeric(commandArgs()[5])

c=a*b


Is ther any way to acess the contents of c in the command line after 
running R ?


Cheers
Jannis



More information about the R-help mailing list