更改R的主目录 [英] Change home directory for R

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

问题描述

不知何故,我在R中的主目录和图书馆目录被更改为一个云位置,这使一堆路径弄乱了,现在,我似乎无法将其改回.当我在R中键入path.expand("~")时,我会返回"C:/Users/MyName/OneDrive/Documents",但是我期望得到"C:/Users/MyName/Documents".

Somehow, my home and library directories in R got changed to a cloud location, which is messing up a bunch of paths, and now, I can't seem to change it back. When I type path.expand("~") in R, I get back "C:/Users/MyName/OneDrive/Documents", but I was expecting to get "C:/Users/MyName/Documents".

当我尝试.libPaths()时,会得到"C:/Users/MyName/OneDrive/Documents/R/win-library/3.4""C:/Program Files/R/R-3.4.3/library",但是我只想要后者.

When I try .libPaths(), I get "C:/Users/MyName/OneDrive/Documents/R/win-library/3.4" and "C:/Program Files/R/R-3.4.3/library", but I only want the latter.

我尝试卸载并重新安装R和RStudio(因此现在可以使用它们的最新版本),但是云路径仍然存在.我在SO的其他地方看到过有关在.Rprofile文件中进行设置的帖子,但是我认为这不是正确的选择,尤其是因为.Rprofile文件随后必须位于我不希望的云位置.

I have tried uninstalling and reinstalling both R and RStudio (thus now working with the most-recent versions of each), but the cloud path persists. I have seen posts elsewhere on SO about setting things in the .Rprofile file, but I don't think that's the right option, especially since the .Rprofile file would then have to be in a cloud location, which I don't want.

我已经在控制面板(在Windows 10中)中查看了我的环境变量,并查看了PATH,但是那里没有指定云目录的内容,所以我不知道它的来源.

I have looked at my environment variables in the control panel (I'm on Windows 10) and looked at PATH, but there's nothing there that specifies the cloud directory, so I don't know where it's coming from.

如何永久更改主目录,并确保.libPaths仅指向实际的库目录?

How do I permanently change my home directory and also make sure that .libPaths is pointing to only the actual library directory?

推荐答案

这基于Windows环境变量HOME.您需要将HOME重置为所需的路径"C:/Users/MyName/Documents"

This is based on your windows environment variable HOME. You need to reset HOME to the path that you want "C:/Users/MyName/Documents"

这篇关于更改R的主目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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