Message-ID: <8ec76080904220842x1899de94s1d2bf85d584bddd5@mail.gmail.com>
Date: 2009-04-22T15:42:32Z
From: Whit Armstrong
Subject: Returning Variables in R to Linux Shell
In-Reply-To: <FFFA004FC961264DB07D5FA80F85EDAF079939@exchange.KLS.corp>
try littler:
warmstrong at linuxsvr2:/tmp$ export MYVALUE=`r -e 'cat(10)'`
warmstrong at linuxsvr2:/tmp$ env|grep MYVALUE
MYVALUE=10
warmstrong at linuxsvr2:/tmp$
On Wed, Apr 22, 2009 at 10:48 AM, Bierbryer, Andrew
<abierbryer at klsdiversified.com> wrote:
> If I have an R script that I am executing from a command line in linux,
> do you know how I can return the value of the variable in my R script to
> the linux environment without writing it to a file in my R script and
> then reading the file through cat?
>
>
>
>
>
> For example, if I had a simple one line R script that just did
>
> ? ? ? ? ? ?string <- 'TEST',
>
>
>
> when I call
>
> /usr/local/bin/R -no-save < MY_R_FILE,
>
>
>
> how can I put the value TEST into a shell variable?
>
>
>
> Thanks,
>
>
>
> Andrew Bierbryer
>
>
>
>
>
>
>
>
>
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>