The natural thing would be to pack this into script, but if you in windows do: echo %1 | Rterm --vanilla -q you run into the problem that everything after the first comma is discarded, unless you use: echo %~1 | Rterm --vanilla -q in which case you will have to quote any R-commands with commas in them. Bendix Carstensen
-----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Liaw, Andy Sent: Friday, March 05, 2004 1:56 PM To: 'Pingping Zheng'; r-help at stat.math.ethz.ch Subject: RE: [R] Command Line Expressions Use echo in a Unix shell and pipe it to R. At the Windows command prompt, you could try: c:\home>echo R.version | Rterm --vanilla -q
R.version
_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 1 minor 8.1 year 2003 month 11 day 21 language R HTH, Andy
From: Pingping Zheng Hi, Is it possible to run R in command line to evalute R
expressions and
return results to stdout, something like
>R CMD -e "R.version$minor"
then you got return
>"8.1"
Or do a simple calculation
>R CMD -e "sin(1.2)" >0.932039
Thanks. -- Pingping Zheng Department of Mathematics and Statistics Fylde College Lancaster University Lancaster LA1 4YF UK
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--------------------------------------------------------------
----------------
Notice: This e-mail message, together with any
attachments,...{{dropped}}
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo> /r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html