Skip to content

Commit

Permalink
Merge pull request #35 from nanxstats/main
Browse files Browse the repository at this point in the history
Style code in `startup.R`
  • Loading branch information
elong0527 authored Feb 21, 2024
2 parents 56308ab + 4dd8dae commit ba1d3e7
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions inst/startup.R
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# Project Level Setup
R_version <- "4.1.3" # set up project R version
snapshot <- "2021-08-31" # set up snapshot date
repos <- paste0("https://packagemanager.posit.co/cran/", snapshot) # set up repository based on snapshot

home <- normalizePath(".") # set up home directory
while(! "DESCRIPTION" %in% list.files(home)){
home <- dirname(home)
# Project-level setup
R_version <- "4.1.3" # Set up project R version
snapshot <- "2021-08-31" # Set up snapshot date
repos <- paste0("https://packagemanager.posit.co/cran/", snapshot) # Set up repository based on snapshot

home <- normalizePath(".") # Set up home directory
while (!"DESCRIPTION" %in% list.files(home)) {
home <- dirname(home)
}

# A&R folder path (Do not edit information below)
path <- list(
home = "", # Project home
adam = "adam", # ADaM data
output = "output" # Output


home = "", # Project home
adam = "adam", # ADaM data
output = "output" # Output
)

path <- lapply(path, function(x) file.path(home, x))

# Define repo URL for project specific package installation
# Define repo URL for project-specific package installation
options(repos = repos)

# Check R Version
if(paste(R.version$major, R.version$minor, sep = ".") != R_version & interactive()){
stop("The current R version is not the same with the current project in ", R_version)
# Check R version
if (paste(R.version$major, R.version$minor, sep = ".") != R_version & interactive()) {
stop("The current R version is not the same with the current project in ", R_version)
}

# Repository
message("Current project R package repository:")
message(paste0(" ", getOption("repos")))
message(" ")

# Display R Session Status
#message("R packages were installed from repo: ", options('repo'), "\n")
message("Below R package path are searching in order to find installed R pacakges in this R session:", "\n",
paste(paste0(" ", .libPaths()), collapse = "\n"))
# Display R session status
# message("R packages were installed from repo: ", options('repo'), "\n")
message(
"Below library paths are searched in order to find installed R pacakges in this R session:", "\n",
paste(paste0(" ", .libPaths()), collapse = "\n")
)
message("\n")

message("The project home directory is ", home)
Expand Down

0 comments on commit ba1d3e7

Please sign in to comment.