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

Comments

@heavywatal
Copy link

@heavywatal heavywatal commented Oct 18, 2018

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
Copy link
Member

@hadley 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 in e04499b Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants