简体   繁体   English

在 R 工作室中将默认工作目录设置为项目文件夹

[英]setting default working directory to project folder in R studio

When I open my R project from the project folder, the default working directory is not my project folder.当我从项目文件夹中打开我的 R 项目时,默认工作目录不是我的项目文件夹。 I thought it should, by default, set the working directory to the project folder.我认为默认情况下应该将工作目录设置为项目文件夹。 I know how to set the working directory but I need to setup r studio so that my R projects open with the project folder as the default working directory.我知道如何设置工作目录,但我需要设置 r 工作室,以便我的 R 项目以项目文件夹作为默认工作目录打开。

I have found that creating .Rprofile file for each project and store it in the same folder as the Rproj file works.我发现为每个项目创建.Rprofile文件并将其存储在与Rproj文件相同的文件夹中。 Thanks to this https://csgillespie.github.io/efficientR/3-3-r-startup.html website about efficient R programming.Only that it means I have to create the .Rprofile file myself every time I create a new project. Thanks to this https://csgillespie.github.io/efficientR/3-3-r-startup.html website about efficient R programming.Only that it means I have to create the .Rprofile file myself every time I create a new project . This is however better than having to set the working directory manually making my projects non-portable.然而,这比必须手动设置工作目录使我的项目不可移植要好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM