-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdot_Rprofile
70 lines (61 loc) · 2.54 KB
/
dot_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
## From the ArchWiki
# The .First function is called after everything else in .Rprofile is executed
.First <- function() {
# Print a welcome message
if (interactive()){
message("Welcome back ", Sys.getenv("USER"),"!\n","working directory is:", getwd())
suppressMessages(library("devtools"))
suppressMessages(library("usethis"))
suppressMessages(library("testthat"))
suppressMessages(library("reprex"))
}
}
## Set CRAN Mirror:
local({
r <- getOption("repos")
## redirects to "best" among worldwide servers, sponsored by RStudio
r["CRAN"] <- "https://cloud.r-project.org/"
options(repos = r)
})
### Disable q() to save workspace
## Create hidden environment
.env <- new.env()
## Define new q() function
.env$q <- function(save = "no", ...) {
quit(save = save, ...)
}
## Attach hidden environment
attach(.env, warn.conflicts = FALSE)
## Options
options(digits = 12) # Number of digits to print. Default is 7, max is 15
options(scipen = 2) # Penalty applied to inhibit the use of scientific notation
options(styler.cache_root = "styler") # Speedup
local({
n <- max(parallel::detectCores() - 2L, 1L) # Detect the number of cores available for use in parallelisation
options(Ncpus = n) # Parallel package installation in install.packages()
options(mc.cores = n) # Parallel apply-type functions via 'parallel' package
})
## Some more options, partially kanged from https://gist.github.com/ijlyttle/dee4a89c8528cd4a0a319bb7b8cdd51a
options(
# if you submit a package to CRAN using devtools,
# it will send an email on your behalf
# - this the name it uses to sign the email
devtools.name = "Rohit Goswami",
# when you create a package using usethis::create_package(), this
# is used to populate the Author field in the DESCRIPTION file
# - an ORCID can be useful, but it is not mandatory: https://orcid.org/
usethis.description = list(
`Authors@R` = 'person("Rohit", "Goswami",
email = "[email protected]",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-2393-8056"))'
),
# depends on your situation to choose ssh or https:
# - https a useful default
# - if you also use GitHub Enterprise, ssh can be useful
usethis.protocol = "https"
)
# Emacs Stuff (cross platform)
# Local Variables:
# mode: r
# End: