Learn R Programming

BIOdry (version 0.9)

mUnits: Metric system

Description

This function control metric units.

Usage

mUnits(x, from = "mm", to = "mm")

Value

numeric vector.

Arguments

x

numeric vector.

from

character. Initial metric unit.

to

character. Final metric unit.

Author

Wilson Lara <wilarhen@gmail.com>, Felipe Bravo <fbravo@pvs.uva.es>

Details

Characters in from and to arguments have the form 'p_', where 'p' is the metric prefix and '_' is a base unit. Sixteen metric prefixes are supported: atto 'a', femto 'f', pico 'p', nano 'n', micro 'mm', mili 'm', centi 'c', deci 'd', deca 'da', hecto 'h', kilo 'k', mega 'M', giga 'G', tera 'T', peta 'P', and exa 'E'.

Examples

Run this code
## Simulation of TRW data
set.seed(1)
w <- abs(rnorm(12,1,1))
trw <- ts(w,start = 1970)
## transforming metric units of trw vector from milimeters to meters
sr <- mUnits(trw, from = 'mm', to = 'm')
attributes(sr)

Run the code above in your browser using DataLab