-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_packages.R
105 lines (91 loc) · 2.29 KB
/
install_packages.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
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
# Install packages to a docker image with renv
#
# This script should be run from the rocker/geospatial:3.6.0 docker image.
# This only is meant for the *initial* creation of renv.lock;
# that file may be subsequently updated as packages are added/updated.
#
# To update a single package after the image is made...
# Launch this container: `docker-compose up -d`
# Within container, start R: `R`
# Within the R session, specify repos:
# ```
# my_repos <- BiocManager::repositories()
# my_repos["CRAN"] <- "https://cran.rstudio.com/"
# options(repos = my_repos)
# ```
# Update(install) your package of choice: `install.packages("whatever")`
# Snapshot specifying the renv library: `renv::snapshot(type = "simple", library = "/renv")`
### Initialize renv ###
# Initialize renv, but don't let it try to find packages to install itself.
install.packages("remotes", repos = "https://cran.rstudio.com/")
# Use dev version with most recent bug fixes
remotes::install_github("rstudio/renv")
renv::consent(provided = TRUE)
renv::init(
bare = TRUE,
force = TRUE,
restart = FALSE)
renv::activate()
### Setup repositories ###
# Install packages that install packages.
install.packages("BiocManager", repos = "https://cran.rstudio.com/")
# (Need to do this again because now we're in a fresh renv project)
install.packages("remotes", repos = "https://cran.rstudio.com/")
# Set repos.
my_repos <- BiocManager::repositories()
my_repos["CRAN"] <- "https://cran.rstudio.com/"
options(repos = my_repos)
### Install CRAN packages ###
cran_packages <- c(
"FD",
"FactoMineR",
"RColorBrewer",
"assertr",
"assertthat",
"bookdown",
"broom",
"caper",
"checkr",
"conflicted",
"corrr",
"cowplot",
"drake",
"future",
"ggrepel",
"ggridges",
"ggtree",
"glue",
"here",
"janitor",
"kableExtra",
"knitr",
"mgcv",
"phytools",
"plantecophys",
"picante",
"pryr",
"scico",
"sme",
"sp",
"spaMM"
"spdep",
"taxize",
"tictoc",
"tidyverse",
"vegan",
"viridis",
"visNetwork",
"tinytex"
)
install.packages(cran_packages)
### Install github packages ###
github_packages <- c(
"adletaw/captioner",
"joelnitta/jntools",
"rstudio/gt",
"thomasp85/patchwork",
"beckyfisher/FSSgam_package"
)
remotes::install_github(github_packages)
### Take snapshot ###
renv::snapshot(type = "simple")