forked from maxplanck-ie/DGE-viz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_Rlibs.R
28 lines (22 loc) · 853 Bytes
/
setup_Rlibs.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
rversion = gsub('R version (.*) (.*)','\\1',sessionInfo()$R.version$version.string)
lib.dir = paste0('Rlib_',rversion)
cran.packages = c('DT',
'data.table',
'dplyr',
'readr',
'ggplot2',
'rlang',
'crosstalk',
'htmlwidgets',
'tidyr',
'tidyselect',
'janitor',
'snakecase')
dir.create(lib.dir, showWarnings = TRUE)
b = !(cran.packages %in% rownames(installed.packages(lib.loc = lib.dir)))
if(all(!b))
stop('All cran.packages installed already. Exit')
cat(paste0(">> Installing packages to \'",lib.dir,"\'\n"), cran.packages[b])
install.packages(cran.packages[b], lib = lib.dir, Ncpus = 4)
# for(pkg0 in cran.packages[b])
# cat(paste0('install.packages(\"',pkg0,'\", lib = \'./Rlib/\', Ncpus = 4)'),'\n')