Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit_r_profile("user") should test R_PROFILE_USER first #480

Closed
heavywatal opened this issue Oct 18, 2018 · 1 comment
Closed

edit_r_profile("user") should test R_PROFILE_USER first #480

heavywatal opened this issue Oct 18, 2018 · 1 comment
Labels
edit 🧞‍♂️ feature a feature request or enhancement

Comments

@heavywatal
Copy link

Currently, edit_r_profile() and edit_r_environ() always try to create/edit a file directly on the user's home directory regardless of R_PROFILE_USER and R_ENVIRON_USER.

Sys.setenv(R_PROFILE_USER = "/tmp/path/to/.Rprofile")
Sys.getenv('R_PROFILE_USER')
#> [1] "/tmp/path/to/.Rprofile"
usethis::edit_r_profile()
#> ● Edit /Users/watal/.Rprofile
#> ● Restart R for changes to take effect
@hadley hadley added feature a feature request or enhancement edit 🧞‍♂️ labels Nov 24, 2018
@hadley
Copy link
Member

hadley commented Nov 25, 2018

This needs a little thought as the existing functions need some refactoring.

Possibly helpful snippet:

envvar <- function(x) {
  env <- Sys.getenv("R_ENVIRON_USER", unset = "")
  if (identical(env, "")) {
    NULL
  } else {
    env
  }
}

@hadley hadley closed this as completed in e04499b Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
edit 🧞‍♂️ feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants