-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rprofile
68 lines (61 loc) · 2.3 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
# Copyright (c) 2024 Victor Vasconcelos. This code should not available anywhere else but
# in github.com/drvictorvs/phd.
# Copyright for the original parts of code that is edited belongs to their respective owners.
# This is a comment. Comments are not run as commands. They are preceded by #.
# Recommended options for safety.
options(
# Shows the call stack on warnings for better debugging
showWarnCalls = T,
# Shows the call stack on errors for better debugging
showErrorCalls = T,
# Warns when named function arguments are matched partially
warnPartialMatchArgs = T,
# Warns when named object attributes are matched partially
warnPartialMatchAttr = T,
# Warns when named list children are matched partially by $
warnPartialMatchDollar = T
)
# Locale configuration. The language is not important, but it should be UTF-8.
# Example locales: English_Ireland.utf8, Portuguese_Portugal.utf8, etc.
Sys.setlocale("LC_ALL", "Portuguese_Brazil.utf8")
# Adds an environment where I add a bunch of misc tools that I use in this project.
# They are attached to the
if(!("VVMisc" %in% search())) {
attach(environment())
VVMisc <- as.environment(2)
attr(VVMisc, "name") <- "VVMisc"
assign("VVMisc", as.environment("VVMisc"), env = as.environment("VVMisc"))
}
# Pacman is a soft requirement. You can just use install.package and library instead.
if(!require(pacman)) {
install.packages('pacman')
}
if(require(pacman)) {
pacman::p_load(install = T, update = F,
'ggplot2','ggpubr','Hmisc','hrbrthemes','lavaan','magrittr', 'mirt','nFactors',
'pillar','psych','rlang','semPlot','semTools','tidyverse')
}
# Attempts to add aforementioned misc tools.
normalizePath('./Functions/utils.R') |>
source(_, echo = F) |>
try()
# Fixes the pillar package, which displays tibbles, to display the proper locale decimal separator
# in tibbles.
if(require("pillar") && require("rlang")){
ain = AssignInNS %|||% assignInNamespace
ain(x = "format_dec",
value = function(s) {
neg <- s$neg
dec <- s$dec
lhs_zero <- s$lhs_zero
OutDec <- getOption("OutDec", locale()$decimal_mark)
if (any(dec)) {
dec_col <- ifelse(dec, style_num(OutDec, neg, !lhs_zero), " ")
}
else {
dec_col <- rep_along(neg, "")
}
invisible(dec_col)
},
ns = "pillar")
}