Skip to content
Back to formatted view

Raw Message

Message-ID: <18928.21094.92607.960193@ron.nulle.part>
Date: 2009-04-23T11:35:02Z
From: Dirk Eddelbuettel
Subject: Returning Variables in R to Linux Shell
In-Reply-To: <8ec76080904220842x1899de94s1d2bf85d584bddd5@mail.gmail.com>

On 22 April 2009 at 11:42, Whit Armstrong wrote:
| 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$

Thanks to a suggestion by Paul Gilbert, littler supports the 'status'
argument to q() to pass result codes back to the shell --- in bash you can
pick that up via $? as shown here:

edd at ron:~> r -e 'q(status=10)'; echo "Status was $?"
Status was 10
edd at ron:~>

Dirk

-- 
Three out of two people have difficulties with fractions.