View source: R/extractInformation.R
epx.extract | R Documentation |
A helper function of read.EpiData
, to extract the xml-like data from an epx-file.
epx.extract(x)
x |
An EpiData epx-file |
A list, containing the following elements:
The entire xml_document from the epx-file.
Information about EpiDatas set up.
Information about the study.
Used separators.
Summary information about the data sets.
Information about parent data sets in relational data bases.
Information from each data set.
Key variables in relational data bases.
# This demonstrates the effects of all six helper functions to \code{\link{read.EpiData}}.
(x <- epx.example("SomeFakeData.epx"))
# epx.extract() extracts the information from an EpiData-epx file
(info <- epx.extract(x))
# epx.read() transforms the information into a data.frame
(dat <- lapply(info$perDataSet, epx.read))
# Combine dat and info in a data-set-wise list
# This is a necessary detour to handle EpiData files with multiple data sets.
perDataSet <- mapply(function(dat, info) list(list(dat = dat, info = info)), dat, info[[7]])
# epx.labels() replaces value codes with value labels
(datLab <- epx.labels(perDataSet$ds1$dat, perDataSet$ds1$info))
# epx.missing() replaces definde missing values with NA
(datMis <- epx.missing(perDataSet$ds1$dat, perDataSet$ds1$info))
# epx.class() sets variable classes according to the field types defined in EpiData
(datClass <- epx.class(perDataSet$ds1$dat, perDataSet$ds$info))
# Bringing it all together
read.EpiData(epx.example("SomeFakeData.epx"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.