append_units.default | R Documentation |
Units attribute is wrapped in open
and
close
, and appended to label.
Result is assigned to target
attribute
(default: 'label').
If style is 'latex' or 'plotmath',
all elements are treated as spork
(as_spork
) and coerced
to canonical form before concatenation.
## Default S3 method:
append_units(
x,
...,
open = getOption("yamlet_append_units_open", " ("),
close = getOption("yamlet_append_units_close", ")"),
style = getOption("yamlet_append_units_style", "plain"),
target = getOption("yamlet_append_units_target", "label")
)
x |
object |
... |
passed to |
open |
character to precede units |
close |
character to follow units |
style |
one of 'plain', 'latex', or 'plotmath' |
target |
attribute name for appended result |
same class as x, with sub-class 'latex' or 'plotmath' depending on style
Other labels:
alias.data.frame()
,
append_units.data.frame()
,
append_units()
,
drop_title.decorated()
,
drop_title.default()
,
drop_title.dvec()
,
drop_title()
,
make_title.decorated()
,
make_title.default()
,
make_title.dvec()
,
make_title()
,
sub_units()
library(units)
library(magrittr)
x <- 1:10
attr(x, 'label') <- 'acceleration'
units(x) <- 'm/s^2'
y <- as_units('kg')
x %>% attr('label')
x %>% append_units %>% attr('label')
y %>% attr('label')
y %>% append_units %>% attr('label')
x %>% append_units(style = 'plain')
x %>% append_units(style = 'plotmath')
x %>% append_units(style = 'latex')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.