Convert x, y coordinates to zones and subzones
Arguments
- x
numeric: the x coordinate
- y
numeric: the y coordinate. If
y
isNULL
,x
will be treated as a grid index (seedv_index2xy
)
Examples
if (FALSE) {
## a bunch of random points on and around the court
idx <- round(runif(100, min = 1, max = 10000))
## convert to zones
zn <- dv_xy2subzone(x = idx)
## or, equivalently, convert the index to xy values first
zn <- cbind(zn, dv_index2xy(idx))
## plot
ggplot(zn, aes(x, y, colour = as.factor(zone), shape = subzone)) + geom_point(size = 3) +
ggcourt(labels = NULL)
## the points shoud be coloured by zone
}