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\'m asking because of a funny bug that is triggered by the presence or absence of the methods package.


回答1:


According to ?Rscript the methods package isn't loaded because, "The default for Rscript omits methods as it takes about 60% of the startup time."



来源:https://stackoverflow.com/questions/19680462/rscript-does-not-load-methods-package-r-does-why-and-what-are-the-consequen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!