elementwise | R Documentation |
Apply a function to each element of an lvec
elementwise(x, fun, ...)
x |
an object of type |
fun |
the function to apply to the |
... |
passed on to |
Returns a link{lvec}
of the same length as the input. The type is
determined by the output of fun
.
# Calculate square root of lvec x <- as_lvec(1:10) y <- elementwise(x, sqrt) # of course, this is already implemented sqrt(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.