rscript

Rscript does not load methods package, R does — why, and what are the consequences?

我们两清 提交于 2019-11-26 22:48:34
Just saw this: $ Rscript -e "sessionInfo()['basePkgs']" $basePkgs [1] "stats" "graphics" "grDevices" "utils" "datasets" "base" $ R --vanilla --slave -e "sessionInfo()['basePkgs']" $basePkgs [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods" [7] "base" The methods package seems to be always available when running R , but not with Rscript . I suspect that this is to gain performance, but are there any practical implications besides the obvious? I'm asking because of a funny bug that is triggered by the presence or absence of the methods package. According to ?Rscript the methods

Rscript: There is no package called …?

大憨熊 提交于 2019-11-26 20:34:01
问题 I want to run R files in batch mode using Rscript, however it does not seem to be loading the libraries that I need. The specific error I am getting is: Error in library(timeSeries) : there is no package called 'timeSeries' Execution halted However I do have the package timeSeries and can load it from Rstudio, RGui, and R from the command line no problem. The issue seems to only be when running a script using Rscript. My system/environment variables are configured as: C:\Program Files\R\R-3.1

Why (or when) is Rscript (or littler) better than R CMD BATCH?

梦想的初衷 提交于 2019-11-26 13:48:26
问题 I am automating some webscraping with R in cron and sometimes I use R CMD BATCH and sometimes I use Rscript . To decide which one to use I mainly focus if I want the .Rout file or not. But reading the answers to some questions here in SO (like this or this) it seems that Rscript is preferred to R CMD BATCH . So my questions are: Besides the fact that the syntax is a little different and R CMD BATCH saves an .Rout file while Rscript does not, what are the main differences between the two of

Rscript does not load methods package, R does — why, and what are the consequences?

和自甴很熟 提交于 2019-11-26 08:29:28
问题 Just saw this: $ Rscript -e \"sessionInfo()[\'basePkgs\']\" $basePkgs [1] \"stats\" \"graphics\" \"grDevices\" \"utils\" \"datasets\" \"base\" $ R --vanilla --slave -e \"sessionInfo()[\'basePkgs\']\" $basePkgs [1] \"stats\" \"graphics\" \"grDevices\" \"utils\" \"datasets\" \"methods\" [7] \"base\" The methods package seems to be always available when running R , but not with Rscript . I suspect that this is to gain performance, but are there any practical implications besides the obvious? I\

Passing command line arguments to R CMD BATCH

淺唱寂寞╮ 提交于 2019-11-26 06:55:21
问题 I have been using R CMD BATCH my_script.R from a terminal to execute an R script. I am now at the point where I would like to pass an argument to the command, but am having some issues getting it working. If I do R CMD BATCH my_script.R blabla then blabla becomes the output file, rather than being interpreted as an argument available to the R script being executed. I have tried Rscript my_script.R blabla which seems to pass on blabla correctly as an argument, but then I don\'t get the my

Determine path of the executing script

这一生的挚爱 提交于 2019-11-26 00:10:35
问题 I have a script called foo.R that includes another script other.R , which is in the same directory: #!/usr/bin/env Rscript message(\"Hello\") source(\"other.R\") But I want R to find that other.R no matter what the current working directory. In other words, foo.R needs to know its own path. How can I do that? 回答1: Here there is a simple solution for the problem. This command: script.dir <- dirname(sys.frame(1)$ofile) returns the path of the current script file. It works after the script was