Learn R Programming

Hmisc (version 5.1-3)

extractlabs: extractlabs

Description

Extract Labels and Units From Multiple Datasets

Usage

extractlabs(..., print = TRUE)

Value

a data table

Arguments

...

one ore more data frames or data tables

print

set to FALSE to not print details about variables with conflicting attributes

Author

Frank Harrell

Details

For one or more data frames/tables extracts all labels and units and comb ines them over dataset, dropping any variables not having either labels or units defined. The resulting data table is returned and is used by the hlab function if the user stores the result in an objectnamed LabelsUnits. The result is NULL if no variable in any dataset has a non-blank label or units. Variables found in more than one dataset with duplicate label and units are consolidated. A warning message is issued when duplicate variables have conflicting labels or units, and by default, details are printed. No attempt is made to resolve these conflicts.

See Also

label(), contents(), units(), hlab()

Examples

Run this code
d <- data.frame(x=1:10, y=(1:10)/10)
d <- upData(d, labels=c(x='X', y='Y'), units=c(x='mmHg'), print=FALSE)
d2 <- d
units(d2$x) <- 'cm'
LabelsUnits <- extractlabs(d, d2)
LabelsUnits

Run the code above in your browser using DataLab