Skip to content

Simple unit cancelation, conversion and parsing for Vegetation and (not yet) Climate modelling.

License

Notifications You must be signed in to change notification settings

joergsteinkamp/DGVMUnits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DGVMUnits

Build Status CRAN_Status_Badge Downloads

Simple unit conversion and parsing for Vegetation and (not yet) Climate modelling.

if("package:DGVMUnits" %in% search()) detach(name = "package:DGVMUnits", unload = TRUE)
library(DGVMUnits)

x <- as.DGVMUnit("kW h m-2")
## returns a simple string
as.character(x)
## returns an expression for usage as e.g. axis label in plots
as.expression(x)

## convert several strings at once (not implrmented by purpose) 
test.str <- c("m2 s", "m2/s", "m^2*s", "W m^-2 s^-1")
x <- as.DGVMUnit(test.str)

## unit division and cancelation
x <- as.DGVMUnit("kg/m2")
y <- as.DGVMUnit("kg m^-2 yr^-1")
ret <- divide(x,y)
as.character(ret)

## multiplication
x <- as.DGVMUnit("kg/m2")
y <- as.DGVMUnit("ha")
ret <- multiply(x,y)
as.character(ret)

About

Simple unit cancelation, conversion and parsing for Vegetation and (not yet) Climate modelling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages