Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

unit

Convert dimensionful quantities to and from SI units


Description

This function takes a number in some specified units and converts that number to SI units, or from SI units to the specified units. Internally, all ctmm objects are specified in SI units, and so this is a utility function to facilitate working with ctmm objects.

Usage

x %#% y

Arguments

x

A numeric quantity specified in y character labeled units, or a character unit label to convert a numeric quantity y that is specified in SI units.

y

A unit character label for the quantity x to be converted to SI units, or a numeric quantity in SI units to be converted into unit label x.

Details

If x is a number and y is a character unit label, then x is converted from units y to SI units. If x is a character unit label and y is a number, then y is converted from SI units to units x.

The default non-SI units include the mean solar 'day', mean synodic 'month' and mean tropical 'year'. These defaults can be changed to conventional calendar units via options(time.units='calendar').

Value

Returns a numeric in SI units or units specified by character label x.

Note

Dimensions of mass and weight are not currently supported as they are not used by ctmm.

Author(s)

C. H. Fleming.

Examples

# one yard -> meters
1 %#% "yard"

# one meter -> yards
"yard" %#% 1

# 1 month -> days
"day" %#% 1 %#% "month"

# 6 miles per hour -> meters per second
"hour" %#% 6 %#% "mile"

# the same conversion in one step
6 %#% "mph"

ctmm

Continuous-Time Movement Modeling

v0.6.0
GPL-3
Authors
Christen H. Fleming [aut, cre], Justin M. Calabrese [aut], Xianghui Dong [ctb], Kevin Winner [ctb], Guillaume Péron [ctb], Michael J. Noonan [ctb], Bart Kranstauber [ctb], Eliezer Gurarie [ctb], Kamran Safi [ctb], Paul C. Cross [dtc], Thomas Mueller [dtc], Rogério C. de Paula [dtc], Thomas Akre [dtc], Jonathan Drescher-Lehman [dtc], Autumn-Lynn Harrison [dtc], Ronaldo G. Morato [dtc]
Initial release
2021-01-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.