最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

rstudio - Using `here` R package in multiple projects - Stack Overflow

programmeradmin1浏览0评论

I am using Here R package in my R projects. At the beginning, when I was having a project, here seemed working fine. Thus I decided to adopt for the remaining projects. However, I am having troubles when I have to use it in multiple projects`.

For example, In the project2, in one of the scripts (new.R), where i need to source another script (dependency.R). The new.R and dependency.R are in the same root directory (of project2).

When I do this normally,source(here(dependency.R), it gives me

Error in file(filename, "r", encoding = encoding) : cannot open the connection In addition: Warning message: In file(filename, "r", encoding = encoding) : cannot open file '/path/to/project1/dependency.R': No such file or directory

I have noticed thanks to this error message, that in RStudio, the project dropdown still shows that the project1. When I close the project and open just the new.R, I get the same error except that I am now in my home directory (/home/user/dependency.R). Thus I was wondering how to properly use here in different projects and limit the scope of `here` to respective project?

My current research tells me to locate using here::here_iam(path/to/README.md) manually. But how is this different from setting the path manually without using here?

My projects are also git repos and I am ok to have them only as git repos (important for me) and not as RProjects at simultaneously. Thus, When I retried, having them only as git repos, I still get the error that I am in the `home/user/` directory not at the project's root directory.

发布评论

评论列表(0)

  1. 暂无评论