read.EpiData: Read EpiData epx-Files

View source: R/readEpiData.R

read.EpiDataR Documentation

Read EpiData epx-Files

Description

Reads EpiData epx-files into a data.frame or a list of data.frames.

Usage

read.EpiData(x, convert = "all")

Arguments

x

An epx-file created by EpiData.

convert

c("all", "none", "missings", "labels", "both") "missings" replaces defined missing values with NA; "labels" replaces value codes with value labels, "both" replaces missing values and value codes and "all" (default) also applies variable classes according to the field types defined in EpiData.

Details

By default, object classes of the variables will be set according to the field type defined in EpiData. Coded variables will be returned as factors with the value labels defined in EpiData. Values that are defined as missing values in EpiData will be set to NA.

All date and time fields are convertet using *Coordinated Usual Time (UTC)* as time zone argument as EpiData does not provide time zone information by default.

Value

A simple data base will be returned as a data.frame. A relational data base will be returned as a list of data.frames.

Study informations are stored as attributes(...)$study.info and variable labels are stored as attributes(...)$variable.labels. For relational data bases, key variables and parent data sets are stored as attributes(...)$info.relations.

Examples

# Read the example data set "marathon.epx"
# (The helper function epx.example is only needed to identify the path
# of the example file in the loaded package).
dat <- read.EpiData(epx.example("SomeFakeData.epx"))
dat

# Extract study information
attributes(dat)$study.info

JohannPopp/epidatR documentation built on Jan. 29, 2024, 1:23 a.m.