Units {Publish}R 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)

[Package Publish version 2023.01.17 Index]