-
Notifications
You must be signed in to change notification settings - Fork 15
/
.Rprofile
41 lines (32 loc) · 1.16 KB
/
.Rprofile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
if (!exists(".__r_profile_loaded") || !isTRUE(.__r_profile_loaded)) {
if (Sys.getenv("R_CONFIG_ACTIVE") != "rstudio_cloud") {
source("renv/activate.R")
} else if (requireNamespace("renv", quietly = TRUE)) {
.libPaths(c(renv::paths$library(), .libPaths()))
}
if (Sys.getenv("R_CONFIG_ACTIVE") == "" && requireNamespace("usethis", quietly = TRUE)) {
message("i Loaded usethis for local development.")
library(usethis)
}
if (Sys.getenv("R_CONFIG_ACTIVE") == "rstudio_cloud") {
if (!"https://p3m.dev/cran/latest" %in% getOption("repos")) {
options(repos = c("P3M" = "https://p3m.dev/cran/latest", getOption("repos")))
}
}
.update_packages <- function() {
source("renv/activate.R")
renv::restore()
message("i Packages updated!")
message("! Restart your R session to use the latest packages.")
}
.update_project <- function() {
message("Stashing your changes...")
system("git stash")
message("Pulling the latest changes...")
system("git pull")
message("Applying your changes...")
system("git stash pop")
message("All set! You're up to date now :)")
}
.__r_profile_loaded <<- TRUE
}