获取R存储每个会话的工作目录 [英] Getting R to store the working directory for every session
问题描述
我在超级用户上问过这个问题,但是有人建议我把它放在这里,因为还有更多的R专家。
I asked this on Super User, but someone suggested that I take it here because there are many more R experts.
当我去文件>更改目录...时,我必须继续浏览我的目录,这是特别烦人的。
I have to keep navigating to my directory when I go to File > Change dir..., which is particularly annoying.
有谁知道如何让R记住以前使用的目录?
Does anyone know how to make R remember the previously used directory?
推荐答案
我将所有与特定项目关联的代码保存在文件中(或更多的是一系列文件)。第一行通常是
I keep all the code associated with a particular project in a file (or more often a series of files). The first line is usually
setwd(...)
设置目录。
一旦工作区已保存在所需的目录中,只需打开R即可该工作区(而不是从桌面或开始菜单)。然后目录已经设置到你想要的地方。
Once a workspace has been saved in the desired directory, just start R by opening that workspace (rather than from the desktop or start menu). Then the directory is already set to where you want it.
这篇关于获取R存储每个会话的工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!