Perform a mathematical rotation about (0, 0) of coordinates. This rotation is given as x' = x \* cos(theta) - y \* sin(theta) y' = x \* sin(theta) + y \* cos(theta)
Source:R/coordinate-transformations.R
rotate_coords.Rd
Perform a mathematical rotation about (0, 0) of coordinates. This rotation is given as x' = x \* cos(theta) - y \* sin(theta) y' = x \* sin(theta) + y \* cos(theta)
Arguments
- df
The data frame to rotate. It must have
x
andy
columns- angle
the angle (in degrees) through which to rotate the coordinates
Examples
rotate_coords(data.frame(x = 0, y = 1))
#> x y
#> 1 -1 6.123234e-17