rotate_coords_df | R Documentation |
Rotates coordinate variable pairs in a data.frame.
rotate_coords_df(
df,
angle,
clockwise = TRUE,
coord_vars = list(pair1 = c("x", "y"), pair2 = c("xend", "yend"), pair3 = c("x_orig",
"y_orig")),
verbose = FALSE,
error = FALSE,
center = c(0, 0),
...
)
df |
Data.frame with numeric coordinate variable pairs. |
angle |
Numeric value. The angle by which the coordinates are rotated. Should range from 1-359. |
clockwise |
Logical value. If |
coord_vars |
Input that denotes the variable pairs. Can be a vector of length two. Or a list of vectors of length two. First element in vector sets name for the x-axis, second value sets name for the y axis. If a list is provided, each slot is checked and invalid slots are removed from the iteration. |
verbose |
Logical. If (Warning messages will always be printed.) |
error |
Logical. If |
... |
Additional arguments given to |
Usually a data.frame that contains variables that refer
to x- and y-coordinates has one single pair of these. E.g. one
variable named x and one variable named y. If so, coord_vars = c("x", "y")
or coord_vars = list(pair1 = c("x", "y")
is appropriate (naming the list
is not necessary). If the data.frame contains several variables that
refer to the same axes but in different scales they can be adjusted altogether.
E.g. a data.frame that contains variable pair x and y as well as col
and row needs coord_vars = list(pair1 = c("x", "y"), pair2 = c("col", "row")
.
For a pair to be adjusted both variables must be found, else the adjustment
is skipped and the function gives feedback if verbose = TRUE
or throws an
error if error = TRUE
. Default sets both to FALSE
which results in
silent skipping.
Adjusted data.frame.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.