parse_xml: Convert a REDCap project XML file to a tidy data frame of...

View source: R/parse_xml.R

parse_xmlR Documentation

Convert a REDCap project XML file to a tidy data frame of project records

Description

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.

Usage

parse_xml(x)

Arguments

x

A REDCap project XML obect of class xml_document, e.g. returned by project_xml

Value

A tibble-style data frame with 6 columns:

  • record_id

  • form

  • redcap_event

  • redcap_repeat_instance

  • field

  • value

Examples

## Not run: 
conn <- rconn(
  url = "https://redcap.msf.fr/api/",
  token = Sys.getenv("MY_REDCAP_TOKEN")
)

parse_xml(project_xml(conn))

## End(Not run)


epicentre-msf/redcap documentation built on April 13, 2025, 3:27 a.m.