Units: Add units to data set

View source: R/Units.R

UnitsR Documentation

Add units to data set

Description

Add variable units to data.frame (or data.table).

Usage

Units(object, units)

Arguments

object

A data.frame or data.table

units

Named list of units. Names are variable names. If omitted, show existing units.

Details

If the object has units existing units are replaced by given units.

Value

The object augmented with attribute "units"

Author(s)

Thomas A. Gerds <tag@biostat.ku.dk>

Examples

data(Diabetes)
Diabetes <- Units(Diabetes,list(BMI="kg/m^2"))
Units(Diabetes)
Diabetes <- Units(Diabetes,list(bp.1s="mm Hg",bp.2s="mm Hg"))
Units(Diabetes)

Publish documentation built on Jan. 18, 2023, 1:08 a.m.