%=>% | R Documentation |
A JavaScript style of creating functions
args %=>% expr
args |
function arguments: see |
expr |
R expression that forms the body of functions: see |
A function that takes args
as parameters and expr
as
the function body
# Formal arguments
c(a) %=>% {
print(a)
}
# Informal arguments
list(a=) %=>% {
print(a)
}
# Multiple inputs
c(a, b = 2, ...) %=>% {
print(c(a, b, ...))
}
# ----- JavaScript style of forEach -----
# ### Equivalent JavaScript Code:
# LETTERS.forEach((el, ii) => {
# console.log('The index of letter ' + el + ' in "x" is: ' + ii);
# });
iapply(LETTERS, c(el, ii) %=>% {
cat2('The index of letter ', el, ' in ', sQuote('x'), ' is: ', ii)
}) -> results
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.