方法一
move the packages from the old R installation into the new version; on Mac OSX, this means moving all folders from here:
/Library/Frameworks/R.framework/Versions/2.15/Resources/library
to here:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library
[where you’ll replace “2.15” and “3.0” with whatever versions you’re upgrading from and to. And only copy whatever packages aren’t already in the destination directory. i.e. don’t overwrite your new ‘base’ package with your old one - if you did, don’t worry, we’ll fix it in the next step anyway. If those paths don’t work for you, try using installed.packages() to find the proper pathnames.]
now you can update your packages by typing update.packages() in your RStudio console, and answering ‘y’ to all of the prompts.
update.packages(checkBuilt=TRUE)
class :
Version 7.3-7 installed in /Library/Frameworks/R.framework/Versions/3.0/Resources/library
Version 7.3-8 available at http://cran.rstudio.com
Update (y/N/c)? y
—etc—
finally, to reassure yourself that you have done everything, type these two commands in the RStudio console to see what you’ve got:
version
packageStatus()
方法二
采用包“installr”
install.packages(“installr”);
require(installr);
using the package:
updateR()

本文介绍了两种在不同版本间迁移R语言包的方法:手动迁移和使用“installr”包进行自动化迁移。手动迁移涉及将旧版本安装的包复制到新版本对应的目录,并通过更新命令确保所有包均为最新版本。
5万+

被折叠的 条评论
为什么被折叠?



