Andrew Piskorski
2021-Aug-12 19:19 UTC
[Rd] Rprofile.site function or variable definitions break with R 4.1
With R 4.1, it seems you can no longer do much in your "Rprofile.site" file. Attempting to define any functions or set any variables there gives errors like these: Error: cannot add binding of 'my_function_name' to the base environment Error: cannot add binding of 'my_variable_name' to the base environment Presumably that's because of this change in R 4.1.0: https://cran.r-project.org/doc/manuals/r-patched/NEWS.html CHANGES IN R 4.1.0 The base environment and its namespace are now locked (so one can no longer add bindings to these or remove from these). Ok, but what's the recommended way to actually USE Rprofile.site now? Should I move all my local configuration into a special package, and do nothing in Rprofile.site except require() that package? Thanks for your help and advice! -- Andrew Piskorski <atp at piskorski.com>
Dirk Eddelbuettel
2021-Aug-12 19:40 UTC
[Rd] Rprofile.site function or variable definitions break with R 4.1
On 12 August 2021 at 15:19, Andrew Piskorski wrote: | Ok, but what's the recommended way to actually USE Rprofile.site now? | Should I move all my local configuration into a special package, and | do nothing in Rprofile.site except require() that package? Exactly as before. I set my mirror as I have before and nothing changes ## We set the cloud mirror, which is 'network-close' to everybody, as default local({ r <- getOption("repos") r["CRAN"] <- "https://cloud.r-project.org" options(repos = r) }) I cannot help but think that you are shooting the messenger (here Rprofile.site) for an actual behaviour change in R itself ? Dirk -- https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org