View source: R/transfromation.R
transform_by_fun | R Documentation |
Transform 2D coordinates by a function(x, y)
transform_by_fun(
x = NULL,
y = NULL,
fun,
along = c("x", "y", "xy"),
xrange.to = NULL,
xrange.from = NULL,
yrange.to = NULL,
yrange.from = NULL,
...
)
x |
a vector of coordinates at x axis |
y |
a vector of coordinates at y axis |
fun |
a function taking |
along |
th independent variables of |
xrange.to |
before transforming, rescale |
xrange.from |
range of |
yrange.to |
same with |
yrange.from |
same with |
... |
other parameters passed to |
a matrix of transformed coordinates
xy <- data.frame(x = 1,
y = 1:100)
xy_tf <- transform_by_fun(xy$x, xy$y, function(x) 0.1*sin(x), along = "y", yrange.to = c(0, 2*pi))
plot(xy)
plot(xy_tf, type = "o")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.