
Hi,

I am trying to run some R commands into my bash scripts and want to use shell variables in the R commands and store the output of R objects into shell variables for further usage in downstream analyses. So far I have managed the first, but how to get values out of R script? I am using  "here documents" (as a starter, maybe something else is simpler or better; suggestions greatly appreciated).

A basic random example:

#!/bin/sh
MYVAR=2
R --slave --quiet --no-save <<EEE
x<-5

z<-x/$MYVAR
zz<-x*$MYVAR
EEE 


How get the values of z and zz into shell variables?


Thanks

D
 		 	   		  
	[[alternative HTML version deleted]]

