Skip to content

Commit

Permalink
Update package versions to handle new cancerprof API updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vsriram24 committed Sep 30, 2024
1 parent 7649d7b commit cc414a7
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 38 deletions.
17 changes: 16 additions & 1 deletion R/incidenceByWAHSA.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ editor: visual

```{r}
library(pak)
pak("getwilds/cancerprof@dev")
pak("getwilds/cancerprof@fix-incidence")
pak("duckdb")
pak("duckplyr")
pak("DBI")
Expand Down Expand Up @@ -194,6 +194,21 @@ cancer_types = c(
```

Test code

```{r}
cancerprof::incidence_cancer(
area = "wa",
areatype = "county",
cancer = "all cancer sites",
race = "black (non-hispanic)",
sex = "both sexes",
age = "ages 65+",
stage = "all stages",
year = "latest 5 year average"
)
```


```{r}
test_data = cancerprof::incidence_cancer(
"USA", "state",
Expand Down
56 changes: 28 additions & 28 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"MASS": {
"Package": "MASS",
"Version": "7.3-60.2",
"Version": "7.3-61",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
Expand All @@ -44,7 +44,7 @@
"stats",
"utils"
],
"Hash": "2f342c46163b0b54d7b64d1f798e2c78"
"Hash": "0cafd6f0500e5deba33be22c46bf6055"
},
"Matrix": {
"Package": "Matrix",
Expand Down Expand Up @@ -185,15 +185,15 @@
},
"cancerprof": {
"Package": "cancerprof",
"Version": "0.1.0",
"Version": "0.1.0.9001",
"Source": "GitHub",
"RemoteType": "github",
"RemoteHost": "api.github.com",
"RemoteRepo": "cancerprof",
"RemoteUsername": "getwilds",
"RemotePkgRef": "getwilds/cancerprof@dev",
"RemoteRef": "dev",
"RemoteSha": "dbb40c85c02db8154b03b2756c1eace7b01f025d",
"RemotePkgRef": "getwilds/cancerprof@fix-incidence",
"RemoteRef": "fix-incidence",
"RemoteSha": "512b1f9b4f0c8234e5be38fabe50c675965fb58b",
"Requirements": [
"R",
"cdlTools",
Expand All @@ -204,9 +204,10 @@
"rlang",
"stringr",
"tibble",
"tidyr",
"utils"
],
"Hash": "91e6f3205da675bd5a840ee0668abeac"
"Hash": "b903f1c3a80c41cd5e1631f44b7e5d0f"
},
"cdlTools": {
"Package": "cdlTools",
Expand Down Expand Up @@ -329,13 +330,13 @@
},
"curl": {
"Package": "curl",
"Version": "5.2.2",
"Version": "5.2.3",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
"Hash": "8f27335f2bcff4d6035edcc82d7d46de"
"Hash": "d91263322a58af798f6cf3b13fd56dde"
},
"dbplyr": {
"Package": "dbplyr",
Expand Down Expand Up @@ -412,16 +413,16 @@
},
"duckdb": {
"Package": "duckdb",
"Version": "1.0.0-2",
"Version": "1.1.0",
"Source": "Repository",
"Repository": "https://packagemanager.posit.co/cran/latest",
"Repository": "CRAN",
"Requirements": [
"DBI",
"R",
"methods",
"utils"
],
"Hash": "c68785a280aa69dbe449b3cf98fa3dd1"
"Hash": "ac14e3bdcaab23293129b451fee02910"
},
"duckplyr": {
"Package": "duckplyr",
Expand All @@ -448,7 +449,7 @@
},
"e1071": {
"Package": "e1071",
"Version": "1.7-14",
"Version": "1.7-16",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
Expand All @@ -460,18 +461,17 @@
"stats",
"utils"
],
"Hash": "4ef372b716824753719a8a38b258442d"
"Hash": "27a09ca40266a1066d62ef5402dd51d6"
},
"evaluate": {
"Package": "evaluate",
"Version": "0.24.0",
"Version": "1.0.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"methods"
"R"
],
"Hash": "a1066cbc05caee9a4bf6d90f194ff4da"
"Hash": "6b567375113ceb7d9f800de4dd42218e"
},
"fansi": {
"Package": "fansi",
Expand Down Expand Up @@ -683,7 +683,7 @@
},
"httr2": {
"Package": "httr2",
"Version": "1.0.3",
"Version": "1.0.4",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
Expand All @@ -700,7 +700,7 @@
"vctrs",
"withr"
],
"Hash": "10d93e97faad6b629301bb3a2fd23378"
"Hash": "836e9564fbeca3bb390bb429a53cd401"
},
"isoband": {
"Package": "isoband",
Expand Down Expand Up @@ -964,7 +964,7 @@
},
"nlme": {
"Package": "nlme",
"Version": "3.1-164",
"Version": "3.1-166",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
Expand All @@ -974,17 +974,17 @@
"stats",
"utils"
],
"Hash": "a623a2239e642806158bc4dc3f51565d"
"Hash": "ccbb8846be320b627e6aa2b4616a2ded"
},
"openssl": {
"Package": "openssl",
"Version": "2.2.1",
"Version": "2.2.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"askpass"
],
"Hash": "c62edf62de70cadf40553e10c739049d"
"Hash": "d413e0fef796c9401a4419485f709ca1"
},
"pak": {
"Package": "pak",
Expand Down Expand Up @@ -1111,13 +1111,13 @@
},
"renv": {
"Package": "renv",
"Version": "1.0.7",
"Version": "1.0.9",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"utils"
],
"Hash": "397b7b2a265bc5a7a06852524dabae20"
"Hash": "ef233f0e9064fc88c898b340c9add5c2"
},
"rlang": {
"Package": "rlang",
Expand Down Expand Up @@ -1496,13 +1496,13 @@
},
"tinytex": {
"Package": "tinytex",
"Version": "0.52",
"Version": "0.53",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"xfun"
],
"Hash": "cfbad971a71f0e27cec22e544a08bc3b"
"Hash": "9db859e8aabbb474293dde3097839420"
},
"tmap": {
"Package": "tmap",
Expand Down
105 changes: 96 additions & 9 deletions renv/activate.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
local({

# the requested version of renv
version <- "1.0.7"
version <- "1.0.9"
attr(version, "sha") <- NULL

# the project directory
Expand Down Expand Up @@ -98,6 +98,66 @@ local({
unloadNamespace("renv")

# load bootstrap tools
ansify <- function(text) {
if (renv_ansify_enabled())
renv_ansify_enhanced(text)
else
renv_ansify_default(text)
}

renv_ansify_enabled <- function() {

override <- Sys.getenv("RENV_ANSIFY_ENABLED", unset = NA)
if (!is.na(override))
return(as.logical(override))

pane <- Sys.getenv("RSTUDIO_CHILD_PROCESS_PANE", unset = NA)
if (identical(pane, "build"))
return(FALSE)

testthat <- Sys.getenv("TESTTHAT", unset = "false")
if (tolower(testthat) %in% "true")
return(FALSE)

iderun <- Sys.getenv("R_CLI_HAS_HYPERLINK_IDE_RUN", unset = "false")
if (tolower(iderun) %in% "false")
return(FALSE)

TRUE

}

renv_ansify_default <- function(text) {
text
}

renv_ansify_enhanced <- function(text) {

# R help links
pattern <- "`\\?(renv::(?:[^`])+)`"
replacement <- "`\033]8;;ide:help:\\1\a?\\1\033]8;;\a`"
text <- gsub(pattern, replacement, text, perl = TRUE)

# runnable code
pattern <- "`(renv::(?:[^`])+)`"
replacement <- "`\033]8;;ide:run:\\1\a\\1\033]8;;\a`"
text <- gsub(pattern, replacement, text, perl = TRUE)

# return ansified text
text

}

renv_ansify_init <- function() {

envir <- renv_envir_self()
if (renv_ansify_enabled())
assign("ansify", renv_ansify_enhanced, envir = envir)
else
assign("ansify", renv_ansify_default, envir = envir)

}

`%||%` <- function(x, y) {
if (is.null(x)) y else x
}
Expand Down Expand Up @@ -142,7 +202,10 @@ local({
# compute common indent
indent <- regexpr("[^[:space:]]", lines)
common <- min(setdiff(indent, -1L)) - leave
paste(substring(lines, common), collapse = "\n")
text <- paste(substring(lines, common), collapse = "\n")

# substitute in ANSI links for executable renv code
ansify(text)

}

Expand Down Expand Up @@ -306,7 +369,11 @@ local({
)

if ("headers" %in% names(formals(utils::download.file)))
args$headers <- renv_bootstrap_download_custom_headers(url)
{
headers <- renv_bootstrap_download_custom_headers(url)
if (length(headers) && is.character(headers))
args$headers <- headers
}

do.call(utils::download.file, args)

Expand Down Expand Up @@ -385,10 +452,22 @@ local({
for (type in types) {
for (repos in renv_bootstrap_repos()) {

# build arguments for utils::available.packages() call
args <- list(type = type, repos = repos)

# add custom headers if available -- note that
# utils::available.packages() will pass this to download.file()
if ("headers" %in% names(formals(utils::download.file)))
{
headers <- renv_bootstrap_download_custom_headers(url)
if (length(headers) && is.character(headers))
args$headers <- headers
}

# retrieve package database
db <- tryCatch(
as.data.frame(
utils::available.packages(type = type, repos = repos),
do.call(utils::available.packages, args),
stringsAsFactors = FALSE
),
error = identity
Expand Down Expand Up @@ -470,23 +549,31 @@ local({

}

renv_bootstrap_github_token <- function() {
for (envvar in c("GITHUB_TOKEN", "GITHUB_PAT", "GH_TOKEN")) {
envval <- Sys.getenv(envvar, unset = NA)
if (!is.na(envval))
return(envval)
}
}

renv_bootstrap_download_github <- function(version) {

enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE")
if (!identical(enabled, "TRUE"))
return(FALSE)

# prepare download options
pat <- Sys.getenv("GITHUB_PAT")
if (nzchar(Sys.which("curl")) && nzchar(pat)) {
token <- renv_bootstrap_github_token()
if (nzchar(Sys.which("curl")) && nzchar(token)) {
fmt <- "--location --fail --header \"Authorization: token %s\""
extra <- sprintf(fmt, pat)
extra <- sprintf(fmt, token)
saved <- options("download.file.method", "download.file.extra")
options(download.file.method = "curl", download.file.extra = extra)
on.exit(do.call(base::options, saved), add = TRUE)
} else if (nzchar(Sys.which("wget")) && nzchar(pat)) {
} else if (nzchar(Sys.which("wget")) && nzchar(token)) {
fmt <- "--header=\"Authorization: token %s\""
extra <- sprintf(fmt, pat)
extra <- sprintf(fmt, token)
saved <- options("download.file.method", "download.file.extra")
options(download.file.method = "wget", download.file.extra = extra)
on.exit(do.call(base::options, saved), add = TRUE)
Expand Down

0 comments on commit cc414a7

Please sign in to comment.