Skip to content

Instantly share code, notes, and snippets.

@matthew-brett
Last active April 15, 2021 13:24
Show Gist options
  • Save matthew-brett/91ab7aba02553c4137d60c4bcb2385a0 to your computer and use it in GitHub Desktop.
Save matthew-brett/91ab7aba02553c4137d60c4bcb2385a0 to your computer and use it in GitHub Desktop.
r_local_dir <- file.path('C:', 'R')
r_tmp_dir <- file.path(r_local_dir, 'tmp')
r_inst_dir <- file.path(r_local_dir, 'win-library', '4.0')
dir.create(r_tmp_dir, recursive=TRUE)
dir.create(r_inst_dir, recursive=TRUE)
r_user_dir <- Sys.getenv('R_USER')
r_env_fn <- file.path(r_user_dir, '.Renviron')
write(paste("TMPDIR='", r_tmp_dir, "'", sep=''), r_env_fn)
write(paste("R_LIBS_USER='", r_inst_dir, "'", sep=''), r_env_fn, append=TRUE)
r_user_dir <- Sys.getenv('R_USER')
r_profile_fn <- file.path(r_user_dir, '.Rprofile')
write('Sys.setenv(LANG = "en")', r_profile_fn, append=TRUE)
write('Sys.setlocale("LC_ALL", "English")', r_profile_fn, append=TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment