Description Usage Arguments Details Examples
Apply a function to a single key-value pair - not a traditional R "apply" function.
1 |
kvPair |
a key-value pair (a list with 2 elements or object created with |
fn |
a function |
Determines how a function should be applied to a key-value pair and then applies it: if the function has two formals, it applies the function giving it the key and the value as the arguments; if the function has one formal, it applies the function giving it just the value. The function is assumed to return a value unless the result is a kvPair
object. When the function returns a value the original key will be returned in the resulting key-value pair.
This provides flexibility and simplicity for when a function is only meant to be applied to the value (the most common case), but still allows keys to be used if desired.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.