#' Rotate points about
#'
#' @description take a set of and rotate it in degrees
#'
#' @param data a data.frame
#' @param x column with x coordinates
#' @param y column with y coordinates
#' @param deg the degree to rotate the points
#' @param cx the x coordinate to rotate around
#' @param cy the y coordinate to rotate around
#'
#' @return a data.frame
#'
#' @export
rotate_points <- function(data, x,y, deg = 0, cx=0, cy=0){
rad <- deg*pi/180
data %>%
dplyr::mutate(
{{x}} := cx + ({{x}} - cx) * cos(rad) - ({{y}} - cy) * sin(rad),
{{y}} := cy + ({{y}} - cy) * cos(rad) + ({{x}} - cx) * sin(rad)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.