Description Usage Arguments Details Value See Also Examples
sets or gets the namer
attribute of a function
1 2 3 4 5 6 7 8 9 10 11 12 |
fun |
function or fseq to convert to a naming function |
namer |
function or string; See Details. |
set_namer
is a function decorator that adds/updates a namer`` attribute of
fun'. It is also a mixin/role for adding additional capabilities to a
function.
The namer
argument can either be a string or function. If a function, this
is used as the naming function. string, the
naming function is to use this function as a suffix '
get_namer
retrieves the naming function.
fun
with appended class 'with_namer' and the namer
attribute set.
'name_it“
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # With functions:
f1 <- mean %>% set_namer( function(x) str_suffix(x,'.mean') )
"price" %>% name_it(f1) # "price.mean"
f2 <- mean %>% set_namer( . %>% str_suffix('.mean') )
"price" %>% name_it(f2) # "price.mean"
f3 <- mean %>% set_namer('.mean')
"price" %>% name_it(f3) # "price.mean"
f4 <- mean %>% set_namer()
"price" %>% name_it(f4) # "price.mean"
f5 <- set_namer(mean)
"price" %>% name_it(f5) # "price.mean"
# With fseq:
f <- . %>% mean( na.rm=TRUE )
f <- set_namer(f)
"price" %>% name_it(f) # "price.mean"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.