transform_by_fun.RdTransform 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)