R/sys_funcCircleCoords.R

Defines functions sys_funcCircleCoords

Documented in sys_funcCircleCoords

#' Generate circle coordinates
#' This function is derived from the 'ggradar' package. \url{https://github.com/ricardo-bion/ggradar/}.
#' Generate coordinates to draw a circle.
#'
#' @param center coordinate for centroid
#' @param r radius
#' @param npoints number of coordinates to generate
#'
#' @return a dataframe
#' @source
#' Adapted from Joran's response to \url{https://stackoverflow.com/questions/6862742/draw-a-circle-with-ggplot2/}.
sys_funcCircleCoords <- function(center = c(0, 0), r = 1, npoints = 100) {
  tt <- seq(0, 2 * pi, length.out = npoints)
  xx <- center[1] + r * cos(tt)
  yy <- center[2] + r * sin(tt)
  return(data.frame(x = xx, y = yy))
}

Try the sysAgNPs package in your browser

Any scripts or data that you put into this service are public.

sysAgNPs documentation built on April 4, 2025, 3:27 a.m.