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

查看:19
本文介绍了你如何在 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')

to 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天全站免登陆