Description Usage Arguments Value Examples
Apply a function to each element of an lvec
1 | 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
.
1 2 3 4 5 | # 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.