Major update. New functions and improvements. See NEWS.md.

This commit is contained in:
AG Damsbo 2023-03-07 15:38:28 +01:00
commit 9f68e27f5a
20 changed files with 443 additions and 97 deletions

View file

@ -4,7 +4,30 @@ test_that("redcap_wider() returns expected output", {
expect_equal(redcap_wider(list),
data.frame(record_id = c(1,2),
age_baseline_long = c(25,26),
age_followup_long = c(27,28),
age_baseline = c(25,26),
age_followup = c(27,28),
gender = c("male","female")))
})
# Using test data
# Set up the path and data -------------------------------------------------
file_paths <- sapply(
c(records = "WARRIORtestForSoftwa_DATA_2018-06-21_1431.csv",
metadata = "WARRIORtestForSoftwareUpgrades_DataDictionary_2018-06-21.csv"),
get_data_location
)
redcap <- lapply(file_paths, read.csv, stringsAsFactors = FALSE)
redcap[["metadata"]] <- with(redcap, metadata[metadata[, 1] > "",])
list <-
with(redcap, REDCap_split(records, metadata, forms = "all"))
wide_ds <- redcap_wider(list)
test_that("redcap_wider() returns wide output from CSV",{
expect_equal(ncol(wide_ds),171)
})