如何更改R中的库位置? [英] How do you change library location in R?

查看:739
本文介绍了如何更改R中的库位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于新的R 2.11版本,我想实施Dirk的建议

Due to the new R 2.11 release, I want to implement Dirk's suggestion here.

因此,我要问-如何(永久)更改R的库路径? (最好的解决方案是可以在R内部运行的解决方案)

So for that I am asking - How can I (permanently) change R's library path? (The best solution would be one that can be run from within R)

推荐答案

您可以在base库中编辑Rprofile(默认情况下在'C:/Program Files/R.Files/library/base/R'中)以包含要在启动时运行的代码.追加

You can edit Rprofile in the base library (in 'C:/Program Files/R.Files/library/base/R' by default) to include code to be run on startup. Append

########        User code        ########
.libPaths('C:/my/dir')

使用任何文本编辑器(例如记事本)将

转换为Rprofile,以使R将'C:/my/dir'添加到它知道的库列表中.

to Rprofile using any text editor (like Notepad) to cause R to add 'C:/my/dir' to the list of libraries it knows about.

(记事本无法保存到程序文件,因此将编辑后的Rprofile保存到其他位置,然后使用Windows资源管理器将其复制.)

(Notepad can't save to Program Files, so save your edited Rprofile somewhere else and then copy it in using Windows Explorer.)

这篇关于如何更改R中的库位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆