-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathr_packages.R
More file actions
54 lines (46 loc) · 1.63 KB
/
r_packages.R
File metadata and controls
54 lines (46 loc) · 1.63 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
safe_install <- function(pkg, ...) {
if (!pkg %in% rownames(installed.packages())) {
tryCatch(
{
install.packages(pkg, ...)
if (!pkg %in% rownames(installed.packages())) {
stop("❌ Package ", pkg, " failed to install (no error thrown, but it's not installed).")
}
},
error = function(e) {
stop("❌ Critical failure installing ", pkg, ": ", conditionMessage(e))
}
)
}
}
# data.table doesn't play well with pak, so we install it first
safe_install("data.table", type = "source")
# First, install pak (modern package installer)
safe_install("pak")
# Core packages for dev, etc.
essential_packages <- c(
# Project management & workflow
"usethis", # Project setup & development workflow helpers
"renv", # Project dependency management
"here", # Project-relative file paths
"fs", # File system operations
# Modern data manipulation
"tidyverse", # Collection of data science packages
# Documentation & reproducibility
"rmarkdown", # Document generation
"quarto", # Next-gen R Markdown
"knitr", # Dynamic report generation
# Development tools
"devtools", # Package development utilities
"testthat", # Unit testing
"roxygen2", # Documentation generation
"lintr", # Code linting
"styler", # Code formatting
"targets", # Pipeline toolkit for reproducible workflows
# IDE tools
"languageserver", # R Language Server for modern IDEs
"jsonlite",
"httpgd"
)
# Use pak for faster parallel installation
pak::pak(essential_packages)