Message-ID: <1351605796228-4647866.post@n4.nabble.com>
Date: 2012-10-30T14:03:16Z
From: sophie
Subject: export variable from bash to R
In-Reply-To: <CANVKczM_k4JfPQBfUhVi8UCpo+cXBO7QDWRaDR3jeUicbn3=0A@mail.gmail.com>
Hi Barry
Thank you very much for your reply. I changed my scripts according to your
suggestions - this is how they look now:
#!/bin/bash
VARIABLES=( a b c d )
for i in ${VARIABLES[@]}; do
export VARIABLENAME=$i
Rscript -e 'source("myscript.R")'
done
and in the R program, I used
args <- Sys.getenv("VARIABLENAME") instead of args <- commandArgs(TRUE)
But when I add the "R --slave", the program hangs, so I left it out (you
said it was just to cut out the startup messages, so I assumed it shouldn't
really matter). It's still not working, though. There is no error message,
but the R program still doesn't seem to be executed (@Krzysztof: The R
program makes plots - since these plots are not produced, I figured that
something with the call of myscript.R is not working)
Any ideas or suggestions?
--
View this message in context: http://r.789695.n4.nabble.com/export-variable-from-bash-to-R-tp4647749p4647866.html
Sent from the R help mailing list archive at Nabble.com.