@@ -100,14 +100,14 @@ if (!requireNamespace("lintr", quietly = TRUE)) {
100100 # Based on testing with whitelisted r-lib.r-universe.dev and cdn.r-universe.dev: both r-universe and remotes work successfully
101101 tryCatch({
102102 # FIRST PRIORITY: Try r-universe installation
103- install.packages("lintr", lib = .libPaths()[1], repos="https://r-lib.r-universe.dev")
103+ install.packages("lintr", lib = .libPaths()[1], repos=c( "https://r-lib.r-universe.dev", "https://cloud.r-project.org") )
104104 cat("SUCCESS: r-universe installation worked\n")
105105 }, error = function(e1) {
106106 cat("r-universe installation failed, trying remotes...\n")
107107 tryCatch({
108108 # FALLBACK: Use remotes for development lintr installation
109109 if (!requireNamespace("remotes", quietly = TRUE)) {
110- install.packages("remotes", lib = .libPaths()[1], repos="https://r-universe.dev")
110+ install.packages("remotes", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
111111 }
112112 remotes::install_github("r-lib/lintr")
113113 cat("SUCCESS: remotes installation worked\n")
@@ -125,7 +125,7 @@ if (!requireNamespace("lintr", quietly = TRUE)) {
125125}'
126126
127127# Install reprex (ESSENTIAL for creating reproducible examples in PRs)
128- sudo apt install -y r-cran-reprex || R --no-restore --no-save -e ' install.packages("reprex", lib = .libPaths()[1], repos="https://r-universe.dev")'
128+ sudo apt install -y r-cran-reprex || R --no-restore --no-save -e ' install.packages("reprex", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
129129
130130# Install other essential development packages via system packages when possible
131131sudo apt install -y r-cran-devtools r-cran-roxygen2 r-cran-styler || echo " Some packages not available via apt, will install via R"
@@ -136,7 +136,7 @@ packages_needed <- c("styler", "roxygen2", "devtools")
136136packages_installed <- rownames(installed.packages())
137137packages_to_install <- setdiff(packages_needed, packages_installed)
138138if (length(packages_to_install) > 0) {
139- install.packages(packages_to_install, lib = .libPaths()[1], repos="https://r-universe.dev")
139+ install.packages(packages_to_install, lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
140140}
141141'
142142```
@@ -172,20 +172,20 @@ if (length(missing_packages) > 0) {
172172``` bash
173173# Step 1: Install required dependencies for reprex
174174sudo apt install -y pandoc
175- R --no-restore --no-save -e ' install.packages(c("knitr", "rmarkdown"), lib = .libPaths()[1], repos="https://r-universe.dev")'
175+ R --no-restore --no-save -e ' install.packages(c("knitr", "rmarkdown"), lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
176176
177177# Step 2: Install reprex package
178178R --no-restore --no-save -e '
179179if (!requireNamespace("reprex", quietly = TRUE)) {
180180 # Try multiple installation methods
181181 tryCatch({
182- install.packages("reprex", lib = .libPaths()[1], repos="https://r-universe.dev")
182+ install.packages("reprex", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
183183 }, error = function(e1) {
184184 tryCatch({
185- install.packages("reprex", lib = .libPaths()[1], repos="https://r-universe.dev")
185+ install.packages("reprex", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
186186 }, error = function(e2) {
187187 if (!requireNamespace("remotes", quietly = TRUE)) {
188- install.packages("remotes", lib = .libPaths()[1], repos="https://r-universe.dev")
188+ install.packages("remotes", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
189189 }
190190 remotes::install_github("tidyverse/reprex")
191191 })
@@ -233,13 +233,13 @@ grep -A2 -B2 "requireNamespace\|check_installed" R/[your_function_file].R
233233``` bash
234234# Step 2: Install ONLY the packages found in Step 1
235235# Example: If working on report.lm(), you might need modelbased and effectsize
236- R --no-restore --no-save -e ' install.packages(c("modelbased", "effectsize"), lib = .libPaths()[1], repos="https://r-universe.dev")'
236+ R --no-restore --no-save -e ' install.packages(c("modelbased", "effectsize"), lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
237237
238238# Example: If working on report.lavaan(), you might need lavaan
239- R --no-restore --no-save -e ' install.packages("lavaan", lib = .libPaths()[1], repos="https://r-universe.dev")'
239+ R --no-restore --no-save -e ' install.packages("lavaan", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
240240
241241# Example: If working on report.brmsfit(), you need brms and related packages
242- R --no-restore --no-save -e ' install.packages(c("brms", "rstanarm"), lib = .libPaths()[1], repos="https://r-universe.dev")'
242+ R --no-restore --no-save -e ' install.packages(c("brms", "rstanarm"), lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
243243```
244244
245245#### Use report's Built-in Utilities (After Building Package)
@@ -256,7 +256,7 @@ if (file.exists("DESCRIPTION")) {
256256# Load report and install only specific packages for your function
257257library(report)
258258# ONLY install packages needed for your specific function:
259- # install.packages("your_specific_package", lib = .libPaths()[1], repos="https://r-universe.dev")
259+ # install.packages("your_specific_package", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
260260'
261261```
262262
@@ -569,13 +569,13 @@ Many functions require optional packages. The package uses `requireNamespace()`
569569
570570``` bash
571571# ALWAYS install reprex first (essential for PR creation):
572- sudo apt install -y r-cran-reprex || R --no-restore --no-save -e ' install.packages("reprex", lib = .libPaths()[1], repos="https://r-universe.dev")'
572+ sudo apt install -y r-cran-reprex || R --no-restore --no-save -e ' install.packages("reprex", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
573573
574574# Via system packages (recommended for individual packages):
575575sudo apt install -y r-cran-[package-name]
576576
577577# Via R (using r-universe for latest packages including development versions):
578- R --no-restore --no-save -e ' install.packages("[package-name]", lib = .libPaths()[1], repos="https://r-universe.dev")'
578+ R --no-restore --no-save -e ' install.packages("[package-name]", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
579579
580580# Alternative sources when r-universe is not available:
581581# Via CRAN mirror (FALLBACK PRIORITY):
@@ -613,16 +613,16 @@ grep -A2 -B2 "requireNamespace\|@importFrom" R/[function_file].R
613613#### Targeted Installation Examples
614614``` bash
615615# Example 1: Working on report.lm() function
616- R --no-restore --no-save -e ' install.packages(c("modelbased", "effectsize"), lib = .libPaths()[1], repos="https://r-universe.dev")'
616+ R --no-restore --no-save -e ' install.packages(c("modelbased", "effectsize"), lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
617617
618618# Example 2: Working on report.lavaan() function
619- R --no-restore --no-save -e ' install.packages("lavaan", lib = .libPaths()[1], repos="https://r-universe.dev")'
619+ R --no-restore --no-save -e ' install.packages("lavaan", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
620620
621621# Example 3: Working on report.brmsfit() function
622- R --no-restore --no-save -e ' install.packages(c("brms", "rstanarm"), lib = .libPaths()[1], repos="https://r-universe.dev")'
622+ R --no-restore --no-save -e ' install.packages(c("brms", "rstanarm"), lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
623623
624624# Example 4: Working on report.BFBayesFactor() function
625- R --no-restore --no-save -e ' install.packages("BayesFactor", lib = .libPaths()[1], repos="https://r-universe.dev")'
625+ R --no-restore --no-save -e ' install.packages("BayesFactor", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
626626```
627627
628628## Code Quality and Best Practices
@@ -1136,11 +1136,11 @@ cat(paste(reprex_result, collapse = "\n"))
11361136
11371137### Styler Not Available
11381138- **Cause**: styler package not installed
1139- - **Solution**: Install via R: `R --no-restore --no-save -e 'install.packages("styler", lib = .libPaths()[1], repos="https://r-universe.dev")'` or skip styling step if not critical
1139+ - **Solution**: Install via R: `R --no-restore --no-save -e 'install.packages("styler", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'` or skip styling step if not critical
11401140
11411141### Roxygen2 Not Available
11421142- **Cause**: roxygen2 package not installed
1143- - **Solution**: Install via R: `R --no-restore --no-save -e 'install.packages("roxygen2", lib = .libPaths()[1], repos="https://r-universe.dev")'` or use devtools: `R --no-restore --no-save -e 'devtools::document()'`
1143+ - **Solution**: Install via R: `R --no-restore --no-save -e 'install.packages("roxygen2", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'` or use devtools: `R --no-restore --no-save -e 'devtools::document()'`
11441144
11451145### Documentation Build Failures
11461146- **Cause**: Documentation not updated after changing roxygen2 comments
@@ -1169,14 +1169,14 @@ cat(paste(reprex_result, collapse = "\n"))
11691169 # Based on testing with whitelisted r-lib.r-universe.dev and cdn.r-universe.dev: both r-universe and remotes work successfully
11701170 tryCatch({
11711171 # FIRST PRIORITY: Try r-universe installation
1172- install.packages("lintr", lib = .libPaths()[1], repos="https://r-lib.r-universe.dev")
1172+ install.packages("lintr", lib = .libPaths()[1], repos=c( "https://r-lib.r-universe.dev", "https://cloud.r-project.org") )
11731173 cat("SUCCESS: r-universe installation worked\n")
11741174 }, error = function(e1) {
11751175 cat("r-universe installation failed, trying remotes...\n")
11761176 tryCatch({
11771177 # FALLBACK: Use remotes for development lintr installation
11781178 if (!requireNamespace("remotes", quietly = TRUE)) {
1179- install.packages("remotes", lib = .libPaths()[1], repos="https://r-universe.dev")
1179+ install.packages("remotes", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
11801180 }
11811181 remotes::install_github("r-lib/lintr")
11821182 cat("SUCCESS: remotes installation worked\n")
@@ -1218,7 +1218,7 @@ cat(paste(reprex_result, collapse = "\n"))
12181218- ** Cause** : Cannot install packages from CRAN mirrors
12191219- ** Solutions** :
12201220 - Use system packages: ` sudo apt install r-cran-[package] `
1221- - Try R-universe (FIRST PRIORITY): ` repos="https://r-universe.dev" `
1221+ - Try R-universe (FIRST PRIORITY): ` repos=c( "https://r-universe.dev", "https://cloud.r-project.org") `
12221222 - Use remotes for GitHub packages (SECOND PRIORITY): ` remotes::install_github("[author]/[package]") `
12231223
12241224### reprex Package Issues and Complete Debugging Guide
@@ -1232,7 +1232,7 @@ cat(paste(reprex_result, collapse = "\n"))
12321232``` bash
12331233# Install core dependencies first
12341234sudo apt install -y pandoc
1235- R --no-restore --no-save -e ' install.packages(c("knitr", "rmarkdown"), lib = .libPaths()[1], repos="https://r-universe.dev")'
1235+ R --no-restore --no-save -e ' install.packages(c("knitr", "rmarkdown"), lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )'
12361236```
12371237
12381238#### Step 2: Install reprex Package
@@ -1241,13 +1241,13 @@ R --no-restore --no-save -e 'install.packages(c("knitr", "rmarkdown"), lib = .li
12411241R --no-restore --no-save -e '
12421242if (!requireNamespace("reprex", quietly = TRUE)) {
12431243 tryCatch({
1244- install.packages("reprex", lib = .libPaths()[1], repos="https://r-universe.dev")
1244+ install.packages("reprex", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
12451245 }, error = function(e1) {
12461246 tryCatch({
1247- install.packages("reprex", lib = .libPaths()[1], repos="https://r-universe.dev")
1247+ install.packages("reprex", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
12481248 }, error = function(e2) {
12491249 if (!requireNamespace("remotes", quietly = TRUE)) {
1250- install.packages("remotes", lib = .libPaths()[1], repos="https://r-universe.dev")
1250+ install.packages("remotes", lib = .libPaths()[1], repos=c( "https://r-universe.dev", "https://cloud.r-project.org") )
12511251 }
12521252 remotes::install_github("tidyverse/reprex")
12531253 })
@@ -1424,7 +1424,7 @@ These workflows run automatically on pushes and pull requests to main/master bra
14241424#### 3. Package Installation Strategy
14251425When packages can't be installed from CRAN:
14261426- ** Primary** : Use system packages via ` sudo apt install r-cran-[package] `
1427- - ** Alternative (FIRST PRIORITY)** : Use R-universe repository: ` repos="https://r-universe.dev" `
1427+ - ** Alternative (FIRST PRIORITY)** : Use R-universe repository: ` repos=c( "https://r-universe.dev", "https://cloud.r-project.org") `
14281428- ** Fallback (SECOND PRIORITY)** : Use remotes for GitHub packages: ` remotes::install_github("[author]/[package]") `
14291429
14301430#### 4. Pre-Commit Validation Checklist
0 commit comments