-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.R
More file actions
59 lines (53 loc) · 1.5 KB
/
init.R
File metadata and controls
59 lines (53 loc) · 1.5 KB
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
options(repos = c(CRAN = "https://cran.rstudio.com"))
# init.R
install_if_needed <- function(packages) {
new_packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new_packages)) install.packages(new_packages)
}
# List of CRAN packages to install
cran_packages <- c(
"tidyr",
"tidytext",
"tidyverse",
"pscl",
"wnominate",
"oc",
"DBI",
"jsonlite",
"SnowballC",
"future.apply",
"RPostgres",
"progress",
"dplyr",
"googlesheets4",
"rvest",
"httr",
"lubridate",
"conflicted",
"shiny",
"plotly",
"ggplot2",
"patchwork",
"scales",
"config",
"shinydisconnect",
"shinyjs",
"shinythemes",
"readr",
"DT",
"shinyWidgets",
"gridExtra"
)
# Install CRAN packages if needed
install_if_needed(cran_packages)
# Install legiscanrr, which needs devtools
if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")
if (!requireNamespace("legiscanrr", quietly = TRUE)) devtools::install_github("fanghuiz/legiscanrr")
# Install dwnominate, which needs remotes
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
if (!requireNamespace("basicspace", quietly = TRUE)) {
install.packages("https://cran.r-project.org/src/contrib/Archive/basicspace/basicspace_0.24.tar.gz", repos = NULL, type = "source")
}
if (!requireNamespace("dwnominate", quietly = TRUE)) remotes::install_github('wmay/dwnominate')
# Set conflicts preference to prioritize all dplyr functions
conflicted::conflict_prefer_all("dplyr", quiet=TRUE)