Learn R Programming

yamlet (version 1.2.1)

as_spork.symbolic_units: Coerce Symbolic Units to Spork

Description

Coerces symbolic units to spork by coercing first to unit_string.

Usage

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

Value

spork

Arguments

x

symbolic_units; see as_units

...

ignored arguments

See Also

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

Examples

Run this code
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)

Run the code above in your browser using DataLab