Convert a REDCap project XML file to a tidy data frame of project records
Source:R/parse_xml.R
parse_xml.Rd
Extract records from a REDCap project XML file (e.g. returned by
project_xml
) and assemble into a tidy long-form data frame, with one row
for each combination of record x field x event x instance.
Arguments
- x
A REDCap project XML obect of class
xml_document
, e.g. returned byproject_xml
Value
A tibble
-style data frame with 6 columns:
record_id
form
redcap_event
redcap_repeat_instance
field
value
Examples
if (FALSE) { # \dontrun{
conn <- rconn(
url = "https://redcap.msf.fr/api/",
token = Sys.getenv("MY_REDCAP_TOKEN")
)
parse_xml(project_xml(conn))
} # }