There is a forever confusing thing when you run the command Rscript: it does not attach the methods package by default. It is confusing because when you start an R session interactively, methods is loaded and attached by default. When you run the command R, it is also attached. It is just Rscript that does not load methods.
This confuses users over, and over, and over again, especially if you love or touch S4 (directly or indirectly). You will surely see questions like this one in the future unless the base R developers decide to change Rscript. It is said that the reason for not loading the methods is because it is slow, “in history”, to load this package.
Okay, let’s see how terribly “slow” it is today. On my MacBook Pro (I should run this multiple times but I think 0.04 should be in the ballpark):
$ Rscript -e "system.time(library(methods))"
user system elapsed
0.035 0.003 0.039
Is 0.04 seconds worth saving? I doubt it. Should it be considered as terribly slow? Here is the loading time of the stats package:
$ R_DEFAULT_PACKAGES=base Rscript -e "system.time(library(stats))"
user system elapsed
0.041 0.013 0.055
Well, that is not a fair comparison, because stats depends on other base packages like grDevices, so here is the result for grDevices:
$ R_DEFAULT_PACKAGES=base Rscript -e "system.time(library(grDevices))"
user system elapsed
0.019 0.007 0.029
I’d say methods is relatively slow to load, but it is not too bad. Given the endless confusion caused by Rscript, I don’t think it is worth excluding it by default. In this case, we have wasted way too much human time on explaining the confusion to save a tiny bit computer time. If users really care about this 0.04 seconds, they should set the environment variable R_DEFAULT_PACKAGES by themselves, and I doubt anyone in the world would do it at all.
It is sad to see things that exist for historical reasons are so hard to change.
P.S. Although S4 is innocent in this case, this is a minor reason why I never liked S4.
- Update on 2017-01-06
-
Gabor discovered that Luke Tierney finally made
Rscriptconsistent withRby default, i.e., methods will be attached in a future version ofRscript. It seems the long-lasting confusion will be ended in 2018.
Donate
As a freelancer (currently working as a contractor) and a dad of three kids, I truly appreciate your donation to support my writing and open-source software development! Your contribution helps me cope with financial uncertainty better, so I can spend more time on producing high-quality content and software. You can make a donation through methods below.
-
Venmo:
@yihui_xie, or Zelle:xie@yihui.name -
Paypal
-
If you have a Paypal account, you can follow the link https://paypal.me/YihuiXie or find me on Paypal via my email
xie@yihui.name. Please choose the payment type as “Family and Friends” (instead of “Goods and Services”) to avoid extra fees. -
If you don’t have Paypal, you may donate through this link via your debit or credit card. Paypal will charge a fee on my side.
-
-
Other ways:
WeChat Pay (微信支付:谢益辉) Alipay (支付宝:谢益辉) 

When sending money, please be sure to add a note “gift” or “donation” if possible, so it won’t be treated as my taxable income but a genuine gift. Needless to say, donation is completely voluntary and I appreciate any amount you can give.
Please feel free to email me if you prefer a different way to give. Thank you very much!
I’ll give back a significant portion of the donations to the open-source community and charities. For the record, I received about $30,000 in total (before tax) in 2024-25, and gave back about $15,000 (after tax).