The --default-packages specifies the packages that you want to download by default. It does not add default packages to the list - it replaces the list. This means that you need to point out all the other base packages that you also rely on. You can see this by running a simple script test that calls sessionInfo()
In the file "env.R":
sessionInfo()
Call from terminal: Rscript env.R
R version 3.1.2 (2014-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets base
Now I am changing this call: Rscript --default-packages=utils env.R
R version 3.1.2 (2014-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] utils base
Therefore, you need to specify other missing packages.
RScript --default-packages=stats,graphics,grDevices,utils,datasets,base,methods env.R
and I threw methods there too.
With that said, if you had no problems when you just ran it using RScript, I don’t understand why you are trying to combine with the default argument. It seems that you are simply creating problems for yourself, if there are no other problems that you are trying to solve, that you are not telling us.
Dason source share