Dear all, Thanks to those 3 people who sent me answers to my question. Got the problem solved. Great! Now, another question of mine is: I would like to run an R script from the Linux prompt. Is there any way possible to do this? The reason is, the calculation that I'm doing takes a few hours, and I would like to automatize it. Or does it mean that I have to run source within the R prompt? Or is there a way to do the automatization within the R prompt? Thanks, Matthew u.i. K?szi, Zoli!
see man R example from a shell: echo -e "pdf(file=\"test.pdf\")\nplot(1:10,11:20)\ndev.off(dev.cur())\n">cmd.R R -s <cmd.R (write a file of command for R, and than feed R with it) On Tuesday 11 January 2005 15:59, Cserh?ti M?ty?s wrote:> Dear all, > > Thanks to those 3 people who sent me answers to my question. Got > the problem solved. Great! > > Now, another question of mine is: > > I would like to run an R script from the Linux prompt. Is there any way > possible to do this? The reason is, the calculation that I'm doing takes a > few hours, and I would like to automatize it. > > Or does it mean that I have to run source within the R prompt? > > Or is there a way to do the automatization within the R prompt? > > Thanks, Matthew > > u.i. K?szi, Zoli! > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html-- ------------------------------------------------------------ Tristan LEFEBURE Laboratoire d'?cologie des hydrosyst?mes fluviaux (UMR 5023) Universit? Lyon I - Campus de la Doua Bat. Darwin C 69622 Villeurbanne - France Phone: (33) (0)4 26 23 44 02 Fax: (33) (0)4 72 43 15 23
Cserh?ti M?ty?s <cs_matyi at freemail.hu> writes:> Dear all, > > Thanks to those 3 people who sent me answers to my question. Got > the problem solved. Great! > > Now, another question of mine is: > > I would like to run an R script from the Linux prompt. Is there any way > possible to do this? The reason is, the calculation that I'm doing takes a > few hours, and I would like to automatize it. > > Or does it mean that I have to run source within the R prompt? > > Or is there a way to do the automatization within the R prompt?This could be what you are looking for: R CMD BATCH myfile.R or maybe R --vanilla < myfile.R both possibly followed by "&" to execute them in the background. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
On Tue, Jan 11, 2005 at 03:59:58PM +0100, Cserh?ti M?ty?s wrote:> I would like to run an R script from the Linux prompt. Is there any way > possible to do this? The reason is, the calculation that I'm doing takes a > few hours, and I would like to automatize it. > > Or does it mean that I have to run source within the R prompt? > > Or is there a way to do the automatization within the R prompt?The standard way (well, my usual way, anyway) is to just use I/O redirection: linux> R --vanilla < stuff.r is, for the most part (see below), equivalent to linux> R > source("stuff.r"); The --vanilla option is necessary to suppress any interactive questions concerning workspace saving (i.e. the "Save workspace image? [y/n/c]" thing); differences between the automated and the interactive form may be due to your script depending on some saved environment, or some stuff in your init files. I'd like to encourage you to automate your calculations, as this enhances not only convenience but also reproducibility of your results. Best regards, Jan -- +- Jan T. Kim -------------------------------------------------------+ | *NEW* email: jtk at cmp.uea.ac.uk | | *NEW* WWW: http://www.cmp.uea.ac.uk/people/jtk | *-----=< hierarchical systems are for files, not for humans >=-----*
Cserh?ti M?ty?s wrote:> > Dear all, > > Thanks to those 3 people who sent me answers to my question. Got > the problem solved. Great! > > Now, another question of mine is: > > I would like to run an R script from the Linux prompt. Is there any way > possible to do this? The reason is, the calculation that I'm doing takes a > few hours, and I would like to automatize it. > > Or does it mean that I have to run source within the R prompt? > > Or is there a way to do the automatization within the R prompt? > > Thanks, Matthew > > u.i. K?szi, Zoli! > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlSee a) the manual "An Introduction to R", Appendix B b) "inside" R type: ?BATCH c) "outside" R type: R CMD BATCH --help Uwe Ligges