-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.R
45 lines (37 loc) · 1.11 KB
/
setup.R
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
# To install {renv}
# install.packages("renv", repos = 'https://packagemanager.posit.co/cran/2024-03-01')
# renv::activate()
#list of required packages
packages <- c("tidyverse",
"rio",
"haven",
"skimr",
"htmlTable",
"rlang",
"ggdist",
"cowplot",
"testthat",
"gt",
"readr",
"usethis",
"knitr",
"tinytex",
"rmarkdown",
"glue",
"gghighlight",
"ggdist",
"ggridges",
"patchwork",
"reprex",
"dplyr")
#function that checks packages status.
pkg_status <- function(x){
if (length(setdiff(packages, rownames(installed.packages()))) == 0){
print("All necessary packages already installed")
}else{
install.packages(setdiff(packages, rownames(installed.packages())),
repos='https://packagemanager.posit.co/cran/2024-03-01')
}
}
#Install and load packages from CRAN if they don't already installed
pkg_status()