View source: R/redcap_toform.R
redcap_toform | R Documentation |
Similar to redcap_export_byform
, this function tries to split a
manually downloaded dataset into it's constituent forms. While use of the API
allows individual forms to be downloaded, with a manual download, only the data
dictionary is available as auxillary information. If no data dictionary is
available, the function will use the variable names to guess the forms (see
details).
redcap_toform(data, datadict = NULL, metadata = NULL, guess_events = TRUE, ...)
data |
imported REDCap data |
datadict |
data dictionary downloaded manually from REDCap |
metadata |
metadata downloaded from REDCap API |
guess_events |
restrict forms to events (rows) where data exists (see details) |
... |
additional arguments passed to other functions (currently unused) |
In a longitudinal data collection with many forms, a REDCap dataset will have
a large degree of empty cells. The guess_events
argument uses missingness
as an indicator of a row not being part of the form in question. If all user
variables (i.e. those that do not start with redcap
) are empty, the row
will be removed from the dataset.
If neither datadict
nor metadata
are provided, the function will
attempt to guess the forms based on the variable names, specifically the
form_complete
variables which denote the state of the form. This is
not a foolproof method: there may be other variables in the data that end with
_complete
.
data <- readRDS(system.file("extdata/test.rda", package = "redcaptools"))
metadata <- readRDS(system.file("extdata/meta.rda", package = "redcaptools"))
dd <- read.csv(system.file("extdata/DataDictionary.csv", package = "redcaptools"))
redcap_toform(data, dd)
redcap_toform(data, metadata = metadata)
redcap_toform(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.