Dear all, I would like to fully document an analysis in R including script, output and workspace data. To do this I currently run under Linux $ R CMD BATCH myscript.R This command combines and saves only the script commands and the output ./myscript.Rout. To save the workspace, I have to explicitly specify the path in the R file and apply save.image(...). How can I save the full workspace with the same naming scheme under the same path, e.g. ./myscript.RData similar to ./myscript.Rout? Note: R CMD BATCH myscript.R --save does not work. Best regards and thanks in advance, Will
Hi Will, I think that save.image() is the way to go. Regarding the directory, its possible to pass arguments to an R script from the command line, or as long as the R script is in the directory you want the image saved in, just save it to the current working directory. Cheers, Josh On Thu, Apr 4, 2013 at 7:18 AM, <will.eagle at gmx.net> wrote:> > Dear all, > > I would like to fully document an analysis in R including script, output and > workspace data. To do this I currently run under Linux > > $ R CMD BATCH myscript.R > > This command combines and saves only the script commands and the output > ./myscript.Rout. To save the workspace, I have to explicitly specify the > path in the R file and apply save.image(...). > > How can I save the full workspace with the same naming scheme under the same > path, e.g. ./myscript.RData similar to ./myscript.Rout? > > Note: R CMD BATCH myscript.R --save does not work. > > Best regards and thanks in advance, > > Will > ______________________________________________ > R-help at r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles joshuawiley.com Senior Analyst - Elkhart Group Ltd. elkhartgroup.com
On 04/04/2013 10:18 AM, will.eagle at gmx.net wrote:> Dear all, > > I would like to fully document an analysis in R including script, output and > workspace data. To do this I currently run under Linux > > $ R CMD BATCH myscript.R > > This command combines and saves only the script commands and the output > ./myscript.Rout. To save the workspace, I have to explicitly specify the > path in the R file and apply save.image(...). > > How can I save the full workspace with the same naming scheme under the same > path, e.g. ./myscript.RData similar to ./myscript.Rout? > > Note: R CMD BATCH myscript.R --save does not work. >By default, R CMD BATCH runs R with --save, so it will save the image in the usual default place. You can use commandArgs() in your script to find the name of the script, and construct a save image filename from that if you want to save somewhere else. Duncan Murdoch
Dear all, thanks for your help which solves the problem! However, I would like to remark that I find the R CMD BATCH command options inconsistent and incomplete, since the .RData path and file name is not (always) the same as the R script and there is no easy control over the path and the name where the .RData file is saved. The root directory or script file name should be given only in one place (the R CMD BATCH command argument) and the other file names should be derived from it. Just my two cents ... Best regards, Will
>The root directory or script > file name should be given only in one place (the R CMD BATCH >command argument) and the other file names should be derived from it.Why? I can think of lots of instances where it would be very unwise to assume that data files would be in the same directory as scripts. Consider web log analysis for one - why would the script be in the server-writeable log file directory? S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}
Windows 7 32 bit R 3.0 RStudio that previously worked with R versions prior to R3.0 Colleagues, I just downloaded R 3.0. When I try to launch RStudio (which was previously on my computer), I get a message, "R Session has a fatal error". Any suggestions for getting RStudio up and running would be appreciated. Thank you, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
Dear John, According to the Rstudio website you need the latest version of Rstudio to work with R 3.0.0. I had the same problem yesterday (on WinXP). Installing the latest Rstudio solved it. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85 Thierry.Onkelinx at inbo.be inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -----Oorspronkelijk bericht----- Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Namens John Sorkin Verzonden: vrijdag 5 april 2013 14:00 Aan: r-help at r-project.org Onderwerp: [R] RStudio and R version 3.0 Windows 7 32 bit R 3.0 RStudio that previously worked with R versions prior to R3.0 Colleagues, I just downloaded R 3.0. When I try to launch RStudio (which was previously on my computer), I get a message, "R Session has a fatal error". Any suggestions for getting RStudio up and running would be appreciated. Thank you, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:13}}
On Fri, 05 Apr 2013 08:00:16 -0400 "John Sorkin" <JSorkin at grecc.umaryland.edu> wrote:> Windows 7 32 bit > R 3.0 > RStudio that previously worked with R versions prior to R3.0 > > Colleagues, > I just downloaded R 3.0. When I try to launch RStudio (which was > previously on my computer), I get a message, "R Session has a fatal > error". Any suggestions for getting RStudio up and running would be > appreciated. Thank you, John > > > > John David Sorkin M.D., Ph.D. > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:18}}