mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-21 05:59:07 +02:00
gp with CRAN in sight
This commit is contained in:
parent
20f08c271b
commit
349ff695e1
24 changed files with 338 additions and 157 deletions
|
|
@ -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)
|
||||
)))
|
||||
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue