#' Get the coordinates for half-court graphics.
#'
#' \code{bb_get_one_side} returns a dataframe which has two new columns representing
#' transformed xy coordinates intended to make half court graphics easier to make.
#'
#' @param data a dataframe
#' @param x_col a column of x coordinates
#' @param y_col a column of y coordinates
#' @keywords bb_get_one_side
#' @export
#'
bb_get_one_side <- function(data, x_col, y_col) {
# define coordinates of half/full court
# -------------------------------------
halfCourt = 470
fullCourt = 940
data$x_one_side <- ifelse(data$x > halfCourt,
(fullCourt - data$x),
data$x)
data$y_one_side <- ifelse(data$x > halfCourt,
(500 - data$y), data$y)
data
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.