as_spork.symbolic_units: Coerce Symbolic Units to Spork

View source: R/spork.R

as_spork.symbolic_unitsR Documentation

Coerce Symbolic Units to Spork

Description

Coerces symbolic units to spork by coercing first to unit_string.

Usage

## S3 method for class 'symbolic_units'
as_spork(x, canonical = TRUE, ...)

Arguments

x

symbolic_units; see as_units

...

ignored arguments

Value

spork

See Also

Other spork: as_spork.unit_string(), as_spork.units()

Examples

library(units)
library(spork)
x <- as_units('kg.m/s^2')
names(attributes(x))
y <- attr(x,'units')
class(y)
as.character(y)
as.character(attr(x, 'units'))
as_spork(y)
library(magrittr)
'kg.m^2/s^2' %>% as_units %>% attr('units') %>% as_spork
'kg.m2 s-2' %>% as_units %>% attr('units') %>% as_spork
'kg.m^2/s^2' %>% as_units %>% attr('units') %>% as_spork(FALSE)
'kg.m2 s-2' %>% as_units %>% attr('units') %>% as_spork(FALSE)

yamlet documentation built on Oct. 6, 2023, 9:07 a.m.