How to change R versions on Mac

∥☆過路亽.° 提交于 2021-02-10 20:42:58

问题


I'm trying to use the legacy version of R to run a package on Mac.

On Windows there is a switch in the General tab. However, it is not found on Mac RStudio. I referred to this post: https://support.rstudio.com/hc/en-us/articles/200486138-Using-Different-Versions-of-R

And I do not quite understand the 3 options:

  1. Run the installer from CRAN for the R version you want to be current
  2. List item Use the RSwitch utility available at: http://r.research.att.com/
  3. Update the R.framework/Versions/Current directory alias directly using ln -s

Especially for RSwitch utility, how do I even open/use that?

Thanks!


回答1:


This old question is again timely, with the move to R version 4.

There is an RSwitch.app available for MacOS 10.14+ that provides this functionality via a menu bar app. You can choose which of your R builds to use, integrating with the standard Mac GUI and with RStudio. (I've had trouble with the newest Mac GUI not working with R 3.6.3 but RStudio seems to work fine with both that and R 4.0.1 along with this RSwitch.app.) The help pages for Rswitch show what's going on underneath, if you prefer to work via a command line.

If you use a standard .pkg via GUI to install a newer version of R it will effectively forget the other versions. You can use the command

pkgutil --forget (path to package name)

with the .pkg to overcome that. (I've had trouble installing from a tarball instead; might just be my incompetence.) Installing an older version from a .pkg won't overwrite a newer version but in that case it might be safest to omit any attempt to instal older Tcl/Tk and Texinfo, selectable with the "Customize" button at the "Installation Type" stage of the installation. With security settings in MacOS you might have trouble opening some R .pkg files; the awkward workaround is to use Control/right/two-finger click on the file in the Finder, then select ‘Open With’ and ‘Installer’ from the menu that appears.

The version of RSwitch.app noted in the question is still available via a link from this page. This is evidently 32-bit as it is disabled on my Mac under OS 10.14.



来源:https://stackoverflow.com/questions/53384262/how-to-change-r-versions-on-mac

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