scale_coords_df | R Documentation |
Scales coordinate variable pairs in a data.frame by multiplying them with a scale factor.
scale_coords_df(
df,
scale_fct = 1,
coord_vars = list(pair1 = c("x", "y"), pair2 = c("xend", "yend"), pair3 = c("col",
"row"), pair4 = c("imagecol", "imagerow")),
verbose = FALSE,
error = FALSE,
...
)
df |
Data.frame with numeric coordinate variable pairs. |
scale_fct |
Numeric value bigger than 0. If used within |
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.