Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ezraporter committed Mar 12, 2024
1 parent 294ad77 commit 7387ad5
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 91 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
2 changes: 1 addition & 1 deletion R/clean_redcap_long.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ clean_redcap_long <- function(db_data_long,
# Retrieve mixed structure fields and forms in reference df
mixed_structure_ref <- get_mixed_structure_fields(db_data_long) %>%
filter(.data$rep_and_nonrep & !str_ends(.data$field_name, "_form_complete")) %>%
left_join(db_metadata_long %>% select(.data$field_name, .data$form_name),
left_join(db_metadata_long %>% select("field_name", "form_name"),
by = "field_name"
)

Expand Down
6 changes: 4 additions & 2 deletions R/supertibble.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ as_supertbl <- function(x) {
x
}

#' @inherit vctrs::vec_ptype_abbr params return title description
#' @export
vec_ptype_abbr.redcap_supertbl <- function(x) {
vec_ptype_abbr.redcap_supertbl <- function(x, ..., prefix_named, suffix_shape) {
"suprtbl"
}

#' @inherit pillar::tbl_sum params return title description
#' @export
tbl_sum.redcap_supertbl <- function(x) {
paste("A REDCapTidier Supertibble with", nrow(x), "instruments")
paste("A REDCapTidieR Supertibble with", nrow(x), "instruments")
}
2 changes: 1 addition & 1 deletion man/REDCapTidieR-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/as_supertbl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/tbl_sum.redcap_supertbl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions man/vec_ptype_abbr.redcap_supertbl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ reference:
- title: "Data"
contents:
- superheroes_supertbl
- title: "S3 methods"
contents:
- tbl_sum.redcap_supertbl
- vec_ptype_abbr.redcap_supertbl
9 changes: 2 additions & 7 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1436,13 +1436,8 @@
},
"renv": {
"Package": "renv",
"Version": "1.0.3",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"utils"
],
"Hash": "41b847654f567341725473431dd0d5ab"
"Version": "1.0.5",
"Source": "Repository"
},
"repr": {
"Package": "repr",
Expand Down
39 changes: 30 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.3"
version <- "1.0.5"
attr(version, "sha") <- NULL

# the project directory
Expand Down Expand Up @@ -31,6 +31,14 @@ local({
if (!is.null(override))
return(override)

# if we're being run in a context where R_LIBS is already set,
# don't load -- presumably we're being run as a sub-process and
# the parent process has already set up library paths for us
rcmd <- Sys.getenv("R_CMD", unset = NA)
rlibs <- Sys.getenv("R_LIBS", unset = NA)
if (!is.na(rlibs) && !is.na(rcmd))
return(FALSE)

# next, check environment variables
# TODO: prefer using the configuration one in the future
envvars <- c(
Expand All @@ -50,9 +58,22 @@ local({

})

if (!enabled)
# bail if we're not enabled
if (!enabled) {

# if we're not enabled, we might still need to manually load
# the user profile here
profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile")
if (file.exists(profile)) {
cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE")
if (tolower(cfg) %in% c("true", "t", "1"))
sys.source(profile, envir = globalenv())
}

return(FALSE)

}

# avoid recursion
if (identical(getOption("renv.autoloader.running"), TRUE)) {
warning("ignoring recursive attempt to run renv autoloader")
Expand Down Expand Up @@ -1041,7 +1062,7 @@ local({
# if jsonlite is loaded, use that instead
if ("jsonlite" %in% loadedNamespaces()) {

json <- catch(renv_json_read_jsonlite(file, text))
json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity)
if (!inherits(json, "error"))
return(json)

Expand All @@ -1050,7 +1071,7 @@ local({
}

# otherwise, fall back to the default JSON reader
json <- catch(renv_json_read_default(file, text))
json <- tryCatch(renv_json_read_default(file, text), error = identity)
if (!inherits(json, "error"))
return(json)

Expand All @@ -1063,14 +1084,14 @@ local({
}

renv_json_read_jsonlite <- function(file = NULL, text = NULL) {
text <- paste(text %||% read(file), collapse = "\n")
text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
jsonlite::fromJSON(txt = text, simplifyVector = FALSE)
}

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

# find strings in the JSON
text <- paste(text %||% read(file), collapse = "\n")
text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
locs <- gregexpr(pattern, text, perl = TRUE)[[1]]

Expand Down Expand Up @@ -1118,14 +1139,14 @@ local({
map <- as.list(map)

# remap strings in object
remapped <- renv_json_remap(json, map)
remapped <- renv_json_read_remap(json, map)

# evaluate
eval(remapped, envir = baseenv())

}

renv_json_remap <- function(json, map) {
renv_json_read_remap <- function(json, map) {

# fix names
if (!is.null(names(json))) {
Expand All @@ -1152,7 +1173,7 @@ local({
# recurse
if (is.recursive(json)) {
for (i in seq_along(json)) {
json[i] <- list(renv_json_remap(json[[i]], map))
json[i] <- list(renv_json_read_remap(json[[i]], map))
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/supertibble.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# supertibble prints with style

Code
as_supertbl(tibble(redcap_form_name = letters[1:5], redcap_data = list(NULL)))
.
Output
# A REDCapTidier Supertibble with 5 instruments
# A REDCapTidieR Supertibble with 5 instruments
redcap_form_name redcap_data
<chr> <list>
1 a <NULL>
Expand Down
134 changes: 67 additions & 67 deletions tests/testthat/_snaps/write.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@
4 Unchecked Checked
5 Unchecked Unchecked
6 Unchecked Unchecked
NA NA NA NA
2 checkbox_multiple_2___4eeee5 yesno NA signature
3 Unchecked yes FALSE signature_2022-08-02_1114.png
4 Unchecked <NA> NA <NA>
5 Unchecked <NA> NA <NA>
6 Unchecked <NA> NA <NA>
NA NA NA NA
2 checkbox_multiple_2___4eeee5 yesno truefalse signature
3 Unchecked yes FALSE signature_2022-08-02_1114.png
4 Unchecked <NA> <NA> <NA>
5 Unchecked <NA> <NA> <NA>
6 Unchecked <NA> <NA> <NA>
NA NA
2 fileupload slider
3 gas_receipt_20220729.jpeg 73
Expand Down Expand Up @@ -1246,73 +1246,73 @@
67 <NA> <NA> <NA> <NA> <NA>
68 <NA> <NA> <NA> <NA> <NA>
Histogram Is the Categorical Value Ordered? Count of Unique Values
2 numeric.hist NA factor.n_unique
3 <NA> NA <NA>
4 <NA> NA <NA>
5 <NA> NA <NA>
6 ▇▁▁▁▇ NA <NA>
7 ▇▁▁▁▇ NA <NA>
8 <NA> NA <NA>
9 <NA> NA <NA>
10 <NA> NA <NA>
11 <NA> NA <NA>
12 ▁▁▇▁▁ NA <NA>
2 numeric.hist factor.ordered factor.n_unique
3 <NA> <NA> <NA>
4 <NA> <NA> <NA>
5 <NA> <NA> <NA>
6 ▇▁▁▁▇ <NA> <NA>
7 ▇▁▁▁▇ <NA> <NA>
8 <NA> <NA> <NA>
9 <NA> <NA> <NA>
10 <NA> <NA> <NA>
11 <NA> <NA> <NA>
12 ▁▁▇▁▁ <NA> <NA>
13 <NA> FALSE 2
14 <NA> FALSE 2
15 <NA> FALSE 0
16 <NA> NA <NA>
17 <NA> NA <NA>
18 <NA> NA <NA>
19 <NA> NA <NA>
20 <NA> NA <NA>
21 <NA> NA <NA>
22 <NA> NA <NA>
23 <NA> NA <NA>
24 <NA> NA <NA>
25 <NA> NA <NA>
26 <NA> NA <NA>
27 <NA> NA <NA>
28 <NA> NA <NA>
29 <NA> NA <NA>
30 <NA> NA <NA>
31 <NA> NA <NA>
32 <NA> NA <NA>
33 <NA> NA <NA>
34 <NA> NA <NA>
35 <NA> NA <NA>
36 <NA> NA <NA>
37 ▁▁▇▁▁ NA <NA>
16 <NA> <NA> <NA>
17 <NA> <NA> <NA>
18 <NA> <NA> <NA>
19 <NA> <NA> <NA>
20 <NA> <NA> <NA>
21 <NA> <NA> <NA>
22 <NA> <NA> <NA>
23 <NA> <NA> <NA>
24 <NA> <NA> <NA>
25 <NA> <NA> <NA>
26 <NA> <NA> <NA>
27 <NA> <NA> <NA>
28 <NA> <NA> <NA>
29 <NA> <NA> <NA>
30 <NA> <NA> <NA>
31 <NA> <NA> <NA>
32 <NA> <NA> <NA>
33 <NA> <NA> <NA>
34 <NA> <NA> <NA>
35 <NA> <NA> <NA>
36 <NA> <NA> <NA>
37 ▁▁▇▁▁ <NA> <NA>
38 <NA> FALSE 0
39 <NA> NA <NA>
40 <NA> NA <NA>
41 <NA> NA <NA>
42 <NA> NA <NA>
43 <NA> NA <NA>
44 <NA> NA <NA>
45 <NA> NA <NA>
46 <NA> NA <NA>
47 <NA> NA <NA>
48 <NA> NA <NA>
49 <NA> NA <NA>
50 <NA> NA <NA>
51 <NA> NA <NA>
52 <NA> NA <NA>
53 <NA> NA <NA>
54 <NA> NA <NA>
55 <NA> NA <NA>
56 <NA> NA <NA>
57 <NA> NA <NA>
58 <NA> NA <NA>
59 <NA> NA <NA>
39 <NA> <NA> <NA>
40 <NA> <NA> <NA>
41 <NA> <NA> <NA>
42 <NA> <NA> <NA>
43 <NA> <NA> <NA>
44 <NA> <NA> <NA>
45 <NA> <NA> <NA>
46 <NA> <NA> <NA>
47 <NA> <NA> <NA>
48 <NA> <NA> <NA>
49 <NA> <NA> <NA>
50 <NA> <NA> <NA>
51 <NA> <NA> <NA>
52 <NA> <NA> <NA>
53 <NA> <NA> <NA>
54 <NA> <NA> <NA>
55 <NA> <NA> <NA>
56 <NA> <NA> <NA>
57 <NA> <NA> <NA>
58 <NA> <NA> <NA>
59 <NA> <NA> <NA>
60 <NA> FALSE 2
61 <NA> NA <NA>
62 <NA> NA <NA>
63 <NA> NA <NA>
64 <NA> NA <NA>
61 <NA> <NA> <NA>
62 <NA> <NA> <NA>
63 <NA> <NA> <NA>
64 <NA> <NA> <NA>
65 <NA> FALSE 2
66 <NA> NA <NA>
67 <NA> NA <NA>
68 <NA> NA <NA>
66 <NA> <NA> <NA>
67 <NA> <NA> <NA>
68 <NA> <NA> <NA>
Most Frequent Values Proportion of TRUE Values Count of Logical Values
2 factor.top_counts logical.mean logical.count
3 <NA> <NA> <NA>
Expand Down

0 comments on commit 7387ad5

Please sign in to comment.