-
Notifications
You must be signed in to change notification settings - Fork 1
/
.Rprofile
65 lines (52 loc) · 2.08 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# setup if using with vscode and R plugin
if (Sys.getenv("TERM_PROGRAM") == "vscode") {
source(file.path(Sys.getenv(if (.Platform$OS.type == "windows") "USERPROFILE" else "HOME"), ".vscode-R", "init.R"))
}
source("renv/activate.R")
if (Sys.getenv("TERM_PROGRAM") == "vscode") {
# obtain list of packages in renv library currently
project <- renv:::renv_project_resolve(NULL)
lib_packages <- names(unclass(renv:::renv_diagnostics_packages_library(project))$Packages)
# detect whether key packages are already installed
# was: !require("languageserver")
if (!"languageserver" %in% lib_packages) {
message("installing languageserver package")
renv::install("languageserver")
}
if (!"httpgd" %in% lib_packages) {
message("installing httpgd package")
renv::install("httpgd")
}
if (!"vscDebugger" %in% lib_packages) {
message("installation vscDebugger package")
renv::install("ManuelHentschel/vscDebugger@v0.4.7")
}
# use the rstudio addins feature
if (!"rstudioapi" %in% lib_packages) {
message("installing rstudioapi package")
renv::install("rstudioapi")
}
options(vsc.rstudioapi = TRUE)
# use the new httpgd plotting device
options(vsc.plot = FALSE)
options(device = function(...) {
httpgd:::hgd()
.vsc.browser(httpgd::hgd_url(), viewer = "Beside")
})
}
# uncomment this section if using a pulseaudio server from a linux host
# play_sound <- function(sound_dir = "/soundboard_files", custom_sink = "SoundBoard", obs_animate = TRUE, wait = FALSE) {
# audio_file <- sample(list.files(sound_dir, full.names = TRUE), size = 1)
# play_args <- c(audio_file)
# if (!is.null(custom_sink)) {
# play_args <- c(play_args, "-d", custom_sink)
# }
# system2("paplay", args = play_args, wait = wait)
# if (obs_animate) {
# system2("curl", paste0("http://192.168.1.178:1030/image?filename=/", audio_file), stdout = FALSE, stderr = FALSE)
# }
# invisible(TRUE)
# }
# options(error = play_sound)
# fix Hugo version
options(blogdown.hugo.version = "0.92.0")