forked from RamiKrispin/vscode-r-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.Rprofile
More file actions
26 lines (24 loc) · 772 Bytes
/
Copy path.Rprofile
File metadata and controls
26 lines (24 loc) · 772 Bytes
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
# Source: https://renkun.me/2020/04/14/writing-r-in-vscode-working-with-multiple-r-sessions/
Sys.setenv(TERM_PROGRAM = "vscode")
source(file.path(
Sys.getenv(
if (.Platform$OS.type == "windows") "USERPROFILE" else "HOME"
),
".vscode-R", "init.R"
))
# Source: https://github.com/REditorSupport/vscode-R/wiki/Plot-viewer#svg-in-httpgd-webpage
if (interactive() && Sys.getenv("TERM_PROGRAM") == "vscode") {
if ("httpgd" %in% .packages(all.available = TRUE)) {
options(vsc.plot = FALSE)
options(device = function(...) {
httpgd::hgd(silent = TRUE)
.vsc.browser(httpgd::hgd_url(history = FALSE), viewer = "Beside")
})
}
}
# Set CRAN Mirror
local({
r <- getOption("repos")
r["CRAN"] <- Sys.getenv("CRAN_MIRROR")
options(repos = r)
})