#' Refreshes in-memory environment variables (if it exists)
#'
#' Equivanent to: `readRenviron("~/.Renviron")`
#'
#' @export
refresh_renviron <- function() {
renv <- path.expand("~/.Renviron")
curr_env <- tidyr::gather(tibble::as_tibble(as.list(Sys.getenv())), env_var, value)
if (file.exists(renv)) readRenviron(renv)
new_env <- tidyr::gather(tibble::as_tibble(as.list(Sys.getenv())), env_var, new_value)
both_env <- full_join(curr_env, new_env, by="env_var")
changed <- filter(both_env, value != new_value)
if (nrow(changed) > 0) {
cat(sprintf("The following environment variables were changed:\n%s",
sprintf(" - %s\n", changed$env_var)))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.