-
Notifications
You must be signed in to change notification settings - Fork 2
/
.Rprofile
174 lines (151 loc) · 4.86 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# nolint start
options(repos = c(CRAN = "https://cran.rstudio.org"))
if (.Platform$OS.type == "windows") {
Sys.setenv(LC_CTYPE = "C")
}
# options(error = renv:::renv_error_handler_call())
# options(warn = 2L)
source("renv/activate.R")
# options(
# clustermq.scheduler = "ssh",
# clustermq.ssh.host = "claster", # use your user and host, obviously
# clustermq.ssh.log = "~/cmq_ssh.log", # log for easier debugging
# clustermq.template = "/workspace/false.alarm/inst/SSH.tmpl"
# )
# options(
# clustermq.scheduler = "multiprocess",
# )
if (Sys.getenv("CI") == "") {
# not CI
# a <- NULL
# suppressMessages(if (requireNamespace("languageserver", quietly = TRUE)) {
# a <- try(suppressWarnings(source(file.path(
# Sys.getenv(if (.Platform$OS.type == "windows") {
# "USERPROFILE"
# } else {
# "HOME"
# }),
# ".vscode-R",
# "init.R"
# ))),
# silent = TRUE
# ) # if this fails we (probably) are in Binder
# })
# if (class(a) == "try-error") { # we are in Binder session (hopefully)
# message("Starting Binder Session")
# setHook("rstudio.sessionInit", function(newSession) {
# if (newSession & is.null(rstudioapi::getActiveProject())) {
# rstudioapi::openProject("false.alarm.Rproj")
# }
# }, action = "append")
# }
# rm(a)
if (interactive() && Sys.getenv("RSTUDIO") == "") {
options(
warnPartialMatchArgs = FALSE,
warnPartialMatchDollar = FALSE,
warnPartialMatchAttr = FALSE,
usethis.protocol = "https",
warn = 1 # warnings appear immediately, not in the end
# error = recover
)
options(
vsc.rstudioapi = TRUE,
max.print = 1000,
width = 200,
# vsc.browser = "Two",
# vsc.viewer = "Two",
# vsc.page_viewer = "Two",
# vsc.view = "Two",
# vsc.plot = "Two",
# vsc.helpPanel = "Two",
# vsc.str.max.level = 2,
vsc.show_object_size = TRUE,
vsc.globalenv = TRUE,
vsc.dev.args = list(width = 1000, height = 700)
)
# renv::install("franzbischoff/tune@539e1eea1426e9ace11b4e71ac4dafadddda7f0a")
# options(renv.settings.ignored.packages = c("parsnip", "yardstick", "dials", "finetune", "recipes", "hardhat", "workflowsets", "tune"))
options(languageserver.formatting_style = function(options) {
style <- styler::tidyverse_style(scope = "tokens", indent_by = 2)
style
})
# if httpgd is installed, let's use it
# This breaks rendering video
# 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")
# })
# }
suppressMessages(
suppressWarnings({
require("testthat", quietly = TRUE)
require("devtools", quietly = TRUE)
require("usethis", quietly = TRUE)
require("conflicted", quietly = TRUE)
# require("tidyverse", quietly = TRUE)
# require("tidymodels", quietly = TRUE)
require("here", quietly = TRUE)
require("glue", quietly = TRUE)
require("workflowr", quietly = TRUE)
require("targets", quietly = TRUE)
require("gittargets", quietly = TRUE)
require("tarchetypes", quietly = TRUE)
})
)
suppressMessages({
conflicted::conflict_prefer("filter", "dplyr")
})
options(dplyr.summarise.inform = FALSE)
if (.Platform$OS.type != "windows") {
if (suppressMessages(requireNamespace("prettycode", quietly = TRUE))) {
suppressMessages(prettycode::prettycode())
}
}
# if (suppressMessages(requireNamespace("prompt", quietly = TRUE))) {
# prompt::set_prompt(function(...) {
# paste0(
# "[",
# prompt::git_branch(),
# prompt::git_dirty(),
# prompt::git_arrows(),
# "] ",
# prompt::prompt_runtime()
# )
# })
# }
if (Sys.getenv("RADIAN_VERSION") == "") {
loadhistory() # if no file, no problem.
# Cleaning up function
.Last <- function() {
savehistory() # comment this line if you don't want to save history
cat("bye bye...\n") # print this so we see if any non-interactive session is lost here
}
}
} else {
# is RSTUDIO
suppressMessages(
suppressWarnings({
require("here", quietly = TRUE)
require("workflowr", quietly = TRUE)
require("targets", quietly = TRUE)
require("tarchetypes", quietly = TRUE)
require("gittargets", quietly = TRUE)
})
)
}
} else {
# is CI
suppressMessages(
suppressWarnings({
require("here", quietly = TRUE)
require("workflowr", quietly = TRUE)
require("targets", quietly = TRUE)
require("tarchetypes", quietly = TRUE)
require("gittargets", quietly = TRUE)
})
)
}
# nolint end