power | R Documentation |
This is an internal function to generate another ones which will be effectivelly exported. This function is not exported in NAMESPACE, therefore it is not available for the end-user.
power(exponent)
exponent |
The exponent. |
A parent function that allows the user to create a closure that returns the n-th power of its argument.
## Not run:
power <- function(exponent) {
function(x) {
x ^ exponent
}
}
square <- power(2)
square_root <- power(.5)
square(2) #4
square_root(4) #2
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.