mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 13:17:30 +02:00
Major update. New functions and improvements. See NEWS.md.
This commit is contained in:
parent
b57e130395
commit
9f68e27f5a
20 changed files with 443 additions and 97 deletions
|
|
@ -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)
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue