I've been playing with R for a while using emacs ESS. I've started to like it a lot ( the beautiful S language was unknown to me before I dumped into R) I want to make some scripts to automate the display of some statistics on web pages. I started to look for ways of using R in a scripting environment but I could not find information on this. Is there a way to call R with command prompt arguments, like a file with a session? Looking at the code I saw in file main.c something that lead me to believe that there must be a way to do it [...] /* File Input/Output */ int R_Interactive = 1; /* Interactive? */ int R_Quiet = 0; /* Be Quiet */ [...] Can someone help me on that? Thanks in advance. Oh! .... and thanks a lot to everybody that made R! -- Pedro Vale Lima email: eq3pvl at eq.uc.pt, pedrovl at yahoo.com Chemical Eng. Dep. Coimbra University _________________________________________________________ DO YOU YAHOO!? Get your free @yahoo.com address at http://mail.yahoo.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> On Thu, 7 May 1998 03:12:40 -0700 (PDT), >>>>> Pedro Lima (PL) wrote:PL> I've been playing with R for a while using emacs ESS. I've started to PL> like it a PL> lot ( the beautiful S language was unknown to me before I dumped into R) PL> I want to make some scripts to automate the display of some statistics PL> on web pages. I started to look for ways of using R in a scripting PL> environment PL> but I could not find information on this. Is there a way to call R with PL> command prompt arguments, like a file with a session? Yes, you simply have to redirect the input of R from stdin to a file, i.e., R [--save|--no-save] < cmdfile reads the commands in cmdfile as if they were typed at the prompt. You have to specify --save or --no-save, stating wether the environment should be saved to the .RData file upon exiting. Best, -- ------------------------------------------------------------------- Friedrich Leisch Institut f?r Statistik Tel: (+43 1) 58801 4546 Technische Universit?t Wien Fax: (+43 1) 504 14 98 Wiedner Hauptstra?e 8-10/1071 Friedrich.Leisch at ci.tuwien.ac.at A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch PGP public key http://www.ci.tuwien.ac.at/~leisch/pgp.key ------------------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 12:57 07/05/98 +0200, you wrote:> >Yes, you simply have to redirect the input of R from stdin to a file, >i.e., > > R [--save|--no-save] < cmdfile > >reads the commands in cmdfile as if they were typed at the prompt. You >have to specify --save or --no-save, stating wether the environment >should be saved to the .RData file upon exiting. > >Best, > >------------------------------------------------------------------- > Friedrich Leisch >Institut f?r Statistik Tel: (+43 1) 58801 4546 >Technische Universit?t Wien Fax: (+43 1) 504 14 98 >Wiedner Hauptstra?e 8-10/1071 Friedrich.Leisch at ci.tuwien.ac.at >A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch > PGP public key http://www.ci.tuwien.ac.at/~leisch/pgp.key >------------------------------------------------------------------- >Does it work (and how) under Windows? (I'm using the version compiled by Guido Masarotto on an NT4 machine). I'v tried, but the screen flashes for a second, and nothing happens. My cmdfile is very simple: x <- rnorm(100) dump("x","x.out") q() The "x.out" file is NOT created. I'v tried the --save and --no-save, but result is the same. Source-ing the same cmdfile works as expected. When trying with Rsept.exe, I get the message "erno was 1411". Thanks for any help Regards Zivan Zivan Karaman Limagrain Genetics Research, B.P. 115, 63203 Riom Cedex, France Tel: +33 (0) 473 634 343 Fax: +33 (0) 473 634 345 E-mail: zivan.karaman at biocem.univ-bpclermont.fr -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Luke Tierney <luke@stat.umn.edu> writes:> Unless I'm very much mistaken (which would not be the first time :-)) > I think you can mix console and graphics behavior under Win32 (NT and > 95, not Win32s) in one application. So having command line options > that choose between creating a command window or using standard > input/output would be possible. I haven't looked into th details yet, > but I'm pretty sure it can be done.Yes. In particular, a console application can do graphs. But if you want to support Win32s, you're more or less stuck with the current model. Another thing: if you want the windowed text interface (scrollbars!) launched from console program, I suspect you get a dangling "DOS-box". I've only seen link-time solutions to that one. So it's probably easier just to make two different .exe files... -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._