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

StackOverflow https://stackoverflow.com/questions/19680462

  •  01-07-2022
  •  | 
  •  

문제

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 package isn't loaded because, "The default for Rscript omits methods as it takes about 60% of the startup time."

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top