Mac下安装R和Rstudio
本教程参考:Window下安装R和Rstudio
1.安装R
1.1 下载R
你能够从http://mirrors.xmu.edu.cn/CRAN/上下载最新的R
.
1.2 安装R
注意: 尽量不要安装到中文路径下, 以后使用时可能会有麻烦
2. 安装RStudio
2.1 下载RStudio
你能够从RStudio官网上下载最新的RStudio
.
2.2 安装RStudio
3. 更新R
3.1 Fool Way
- 备份你的程序包
重新安装R软件时可能会把你已经安装的package
覆盖, 为了避免,我们需要先进行备份(将library
文件夹复制到他处)。
程序包位置:/Library/Frameworks/R.framework/Versions/3.2/Resources/library
如何进入路径
打开
finder
, 使用⌘(command)+⇧(shift)+G
, 输入上面路径就可以进入路径
- 重复
1.1
和1.2
3.2 The Harder Way
Now we set up the global library for R. More details about this is described in [Tal Galili’s blog post][1]. Although you are using the latest version of R, you can still follow my steps. It will help you set a global library for R. This will prevent some troubles in the future.
Open your R. Run chooseCRANmirror()
command line(Type it and hit ENTER
) .Choose China(Xiamen)
.
Run the following codes line by line.
It will ask you whether or not to quit R. Just type n
and hit ENTER
. Then run New.R.RunMe()
just the same way.
Once you have done these, from now on, whenever you want to update to a new version of R in the future, all you will need to do are the following TWO steps:
- Download and install the new version of R
- Open your new R and run the following codes