install.packages("installr")
library(installr)
updateR()
然後就會提示最新的R版本,和是否需要拷貝老版本的R程序包目錄,是否需要移除老的程序包目錄以及是否更新新的版本中的程序包。一切搞定之後會提醒你是否需要打開新的RGui,程序會默認將系統的默認R設置爲最新版,因此RStudio也會自動切換到最新的R版本。下面是升級之後RStudio的啓動提示
R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
可以查看一下現在程序包裏的庫都是對應哪個版本的R編譯的(圖片見文章開頭):
pkgs<-installed.packages()
plot(as.factor(pkgs[,'Built']),col=2:4,main='Packages built version',ylab='Count of packages')
可以看到大部分程序包都更新到了最新的R,但是還有不少還停留在大版本號3.1.0上,也有小部分還是3.1.11。總的來看,R的升級還是很成功的,使用起來也很方面。
參考文章:http://bbs.pinggu.org/thread-3722753-1-1.html