rotate_coords: Perform a mathematical rotation about (0, 0) of coordinates....

View source: R/coordinate-transformations.R

rotate_coordsR Documentation

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)

Description

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)

Usage

rotate_coords(df, angle = 90)

Arguments

df

The data frame to rotate. It must have x and y columns

angle

the angle (in degrees) through which to rotate the coordinates

Value

The rotated data frame

Examples

rotate_coords(data.frame(x = 0, y = 1))


sportsdataverse/sportyR documentation built on Feb. 17, 2024, 9:44 p.m.