Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source("renv/activate.R")
2 changes: 1 addition & 1 deletion R/get_business_patterns.R
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ get_business_patterns = function(year = 2023, geo = "county", naics_code_digits
year, zip_code, employees, employers, annual_payroll,
industry, employee_size_range_label, employee_size_range_code, naics_code) } }

return(cbp)
return(cbp %>% tibble::as_tibble())
}

utils::globalVariables(
Expand Down
485 changes: 161 additions & 324 deletions renv.lock

Large diffs are not rendered by default.

101 changes: 93 additions & 8 deletions renv/activate.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
local({

# the requested version of renv
version <- "1.1.5"
version <- "1.1.7"
attr(version, "md5") <- "dd5d60f155dadff4c88c2fc6680504b4"
attr(version, "sha") <- NULL

# the project directory
Expand Down Expand Up @@ -168,6 +169,16 @@ local({
if (quiet)
return(invisible())

# also check for config environment variables that should suppress messages
# https://github.com/rstudio/renv/issues/2214
enabled <- Sys.getenv("RENV_CONFIG_STARTUP_QUIET", unset = NA)
if (!is.na(enabled) && tolower(enabled) %in% c("true", "1"))
return(invisible())

enabled <- Sys.getenv("RENV_CONFIG_SYNCHRONIZED_CHECK", unset = NA)
if (!is.na(enabled) && tolower(enabled) %in% c("false", "0"))
return(invisible())

msg <- sprintf(fmt, ...)
cat(msg, file = stdout(), sep = if (appendLF) "\n" else "")

Expand Down Expand Up @@ -215,6 +226,16 @@ local({
section <- header(sprintf("Bootstrapping renv %s", friendly))
catf(section)

# try to install renv from cache
md5 <- attr(version, "md5", exact = TRUE)
if (length(md5)) {
pkgpath <- renv_bootstrap_find(version)
if (length(pkgpath) && file.exists(pkgpath)) {
file.copy(pkgpath, library, recursive = TRUE)
return(invisible())
}
}

# attempt to download renv
catf("- Downloading renv ... ", appendLF = FALSE)
withCallingHandlers(
Expand All @@ -240,7 +261,6 @@ local({

# add empty line to break up bootstrapping from normal output
catf("")

return(invisible())
}

Expand All @@ -257,12 +277,20 @@ local({
repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA)
if (!is.na(repos)) {

# check for RSPM; if set, use a fallback repository for renv
rspm <- Sys.getenv("RSPM", unset = NA)
if (identical(rspm, repos))
repos <- c(RSPM = rspm, CRAN = cran)
# split on ';' if present
parts <- strsplit(repos, ";", fixed = TRUE)[[1L]]

return(repos)
# split into named repositories if present
idx <- regexpr("=", parts, fixed = TRUE)
keys <- substring(parts, 1L, idx - 1L)
vals <- substring(parts, idx + 1L)
names(vals) <- keys

# if we have a single unnamed repository, call it CRAN
if (length(vals) == 1L && identical(keys, ""))
names(vals) <- "CRAN"

return(vals)

}

Expand Down Expand Up @@ -511,6 +539,51 @@ local({

}

renv_bootstrap_find <- function(version) {

path <- renv_bootstrap_find_cache(version)
if (length(path) && file.exists(path)) {
catf("- Using renv %s from global package cache", version)
return(path)
}

}

renv_bootstrap_find_cache <- function(version) {

md5 <- attr(version, "md5", exact = TRUE)
if (is.null(md5))
return()

# infer path to renv cache
cache <- Sys.getenv("RENV_PATHS_CACHE", unset = "")
if (!nzchar(cache)) {
root <- Sys.getenv("RENV_PATHS_ROOT", unset = NA)
if (!is.na(root))
cache <- file.path(root, "cache")
}

if (!nzchar(cache)) {
tools <- asNamespace("tools")
if (is.function(tools$R_user_dir)) {
root <- tools$R_user_dir("renv", "cache")
cache <- file.path(root, "cache")
}
}

# start completing path to cache
file.path(
cache,
renv_bootstrap_cache_version(),
renv_bootstrap_platform_prefix(),
"renv",
version,
md5,
"renv"
)

}

renv_bootstrap_download_tarball <- function(version) {

# if the user has provided the path to a tarball via
Expand Down Expand Up @@ -979,7 +1052,7 @@ local({

renv_bootstrap_validate_version_release <- function(version, description) {
expected <- description[["Version"]]
is.character(expected) && identical(expected, version)
is.character(expected) && identical(c(expected), c(version))
}

renv_bootstrap_hash_text <- function(text) {
Expand Down Expand Up @@ -1181,6 +1254,18 @@ local({

}

renv_bootstrap_cache_version <- function() {
# NOTE: users should normally not override the cache version;
# this is provided just to make testing easier
Sys.getenv("RENV_CACHE_VERSION", unset = "v5")
}

renv_bootstrap_cache_version_previous <- function() {
version <- renv_bootstrap_cache_version()
number <- as.integer(substring(version, 2L))
paste("v", number - 1L, sep = "")
}

renv_json_read <- function(file = NULL, text = NULL) {

jlerr <- NULL
Expand Down
80 changes: 0 additions & 80 deletions temporary-scripts/pull_fire_risk_data.R

This file was deleted.

Loading
Loading