loadDataADaMSDTM: Load data from ADaM/SDTM file(s).

View source: R/loadDataADaMSDTM.R

loadDataADaMSDTMR Documentation

Load data from ADaM/SDTM file(s).

Description

Load data set from SAS format into R data.frames.

Usage

loadDataADaMSDTM(
  files,
  convertToDate = FALSE,
  dateVars = "DTC$",
  verbose = TRUE,
  encoding = "UTF-8",
  ...
)

Arguments

files

Character vector with path to ADaM or SDTM file(s). Currently only import of files with extension: 'sas7bdat' or 'xpt' are supported.

convertToDate

logical, if TRUE columns with date/time are converted to POSIXct format, which stores calendar date/time in R. Please note that most of the time this is not necessary, as date variables are automatically imported via the haven package if encoded correctly in the dataset.

dateVars

vector of columns in data containing date/time, or pattern for this columns. By default all columns ending with 'DTC' are used (dateVars is: 'DTC$').

verbose

logical, if TRUE (by default) progress messages are printed during execution.

encoding

String with encoding, only used if files is of extension: 'sas7bdat', 'UTF-8' by default.

...

Additional parameters for the read_sas or read_xpt functions, depending on the input file type.

Details

While creating the R data.frames, if date/time variables are present, those are converted into to R date/time class (see convertToDateTime) function.

The labels of the ADaM/SDTM data sets are attached as attributes of the R data.frame.

Value

List of data.frame with data of each ADAM file (if not empty), with special attributes 'labelVars': named vector with label of the variables. Each data.frame contains an additional column called 'dataset' specifying the name of the files it was read from.

Author(s)

Laure Cougnaud

Examples

## Not run: 
dataFromSAS7bdat <- loadDataADaMSDTM(files = "ae.sas7bdat")
attr(dataFromSAS7bdat, "labelVars") # column labels
dataFromXpt <- loadDataADaMSDTM(files = c("ae.xpt", "dm.xpt"))
attr(dataFromXpt, "labelVars") # column labels

## End(Not run)

clinUtils documentation built on Jan. 6, 2023, 5:29 p.m.