gp with CRAN in sight

This commit is contained in:
AG Damsbo 2023-04-13 10:57:04 +02:00
commit 349ff695e1
24 changed files with 338 additions and 157 deletions

View file

@ -1,5 +1,6 @@
# Global variables --------------------------------------------------------
# Cars
@ -12,14 +13,15 @@ records <-
redcap_output_json <- REDCap_split(records, metadata, forms = "all")
# Longitudinal
file_paths <- sapply(
file_paths <- vapply(
c(records = "WARRIORtestForSoftwa_DATA_2018-06-21_1431.csv",
metadata = "WARRIORtestForSoftwareUpgrades_DataDictionary_2018-06-21.csv"),
FUN.VALUE = "character",
get_data_location
)
redcap <- lapply(file_paths, read.csv, stringsAsFactors = FALSE)
redcap[["metadata"]] <- with(redcap, metadata[metadata[, 1] > "",])
redcap[["metadata"]] <- with(redcap, metadata[metadata[, 1] > "", ])
redcap_output_long <-
with(redcap, REDCap_split(records, metadata, forms = "all"))
redcap_long_names <- names(redcap[[1]])
@ -35,7 +37,7 @@ test_that("Each form is an element in the list", {
test_that("All variables land somewhere", {
expect_true(setequal(names(records), Reduce(
"union", sapply(redcap_output_json, names)
"union", lapply(redcap_output_json, names)
)))
})
@ -47,11 +49,8 @@ test_that("Primary table name is ignored", {
})
test_that("Supports longitudinal data", {
# setdiff(redcap_long_names, Reduce("union", sapply(redcap_output_long, names)))
## [1] "informed_consent_and_addendum_timestamp"
expect_true(setequal(redcap_long_names, Reduce(
"union", sapply(redcap_output_long, names)
"union", lapply(redcap_output_long, names)
)))
})