[英]r - my rprofile is running multiple times
My .Rprofile
always runs twice.我的
.Rprofile
总是运行两次。 I looked at this thread and think it might be because the slashes are going in various directions.我看着这个线程,认为这可能是因为斜线在不同的方向。
I only have code in the paths pointing at C:/Users/rileyj3/.Rprofile
(results 1, 2 & 4).我在指向
C:/Users/rileyj3/.Rprofile
的路径中只有代码(结果 1、2 和 4)。 Does anyone know how to resolve?有谁知道如何解决?
expr![]() |
path![]() |
exists![]() |
---|---|---|
file.path(getwd(), ".Rprofile") ![]() |
C:/Users/rileyj3/.Rprofile ![]() |
TRUE![]() |
file.path(Sys.getenv("HOME"), ".Rprofile") ![]() |
C:\Users\rileyj3/.Rprofile ![]() |
TRUE![]() |
file.path(Sys.getenv("R_HOME"), "etc", "Rprofile.site") ![]() |
C:/PROGRA~1/R/R-42~1.2/etc/Rprofile.site ![]() |
TRUE![]() |
Sys.getenv("R_PROFILE") ![]() |
C:\Users\rileyj3.Rprofile ![]() |
TRUE![]() |
Sys.getenv("R_PROFILE_USER") ![]() |
FALSE![]() |
library(tidyverse) tibble( expr = c( 'file.path(getwd(), ".Rprofile")', 'file.path(Sys.getenv("HOME"), ".Rprofile")', 'file.path(Sys.getenv("R_HOME"), "etc", "Rprofile.site")', 'Sys.getenv("R_PROFILE")', 'Sys.getenv("R_PROFILE_USER")' ) ) |> mutate( path = map_chr(expr, ~parse(text =.x) |> eval()), exists = file.exists(path) ) |> knitr::kable()
You can see the details of R read Rprofile files on the ?Startup
help page.您可以在
?Startup
帮助页面上查看 R 读取 Rprofile 文件的详细信息。
R will look for both a site-wide and user-specific profile. R 将查找站点范围和用户特定的配置文件。 Since you have a value set for R_PROFILE, that's considered a site-wide profile so it's run.
由于您为 R_PROFILE 设置了一个值,它被认为是一个站点范围的配置文件,所以它会运行。 Then when R looks for a user-specific value, it finds the one in your home directory so it runs that one as well.
然后,当 R 查找特定于用户的值时,它会在您的主目录中找到该值,因此它也会运行该值。 R doesn't check to see if the site-wide and specific files are the same.
R 不会检查站点范围的文件和特定的文件是否相同。 You should probably remove the R_PROFILE system environment variable since you seem to be setting a user-specific values there or move it to R_PROFILE_USER.
您可能应该删除 R_PROFILE 系统环境变量,因为您似乎在那里设置了用户特定的值或将其移至 R_PROFILE_USER。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.