emptyCorner: Find the corner of a plot region that is most empty of plot...

View source: R/emptyCorner.r

emptyCornerR Documentation

Find the corner of a plot region that is most empty of plot elements

Description

This function identifies the corner of a plot region that is the least occupied by plot elements.

Usage

emptyCorner(x, by = "distance", onlyIn = TRUE, least = TRUE)

Arguments

x

A two-column matrix or data frame with points representing plot items.

by

Character, method by which to identify the "most empty" quadrat. Any of (partial matching is OK, and case is ignored):

  • 'distance' (default): Find the corner that has the greatest distance between it and the closest point.

  • 'density': Find the corner that has the least density of points.

  • 'dd': Find the corner that has the least density of closest points.

onlyIn

Logical, if TRUE (default), only consider plot items that are in the plot region.

least

Logical, if TRUE (default), then indicate the least-occupied corner. If FALSE then indicate the most-occupied corner.

Details

Note that you must already have a plot made for this to work.

Value

Character indicating the corner that is the least occupied.

Examples

# generate some numbers
set.seed(123)
x <- c(4, rnorm(100), runif(200, -2, 0))
y <- c(2, rnorm(100), runif(200, -2, 0))
xlim <- c(min(x), 1.5 * max(x))
plot(x, y, xlim=xlim)
xy <- cbind(x, y)
emptyCorner(xy)
emptyCorner(xy, by='density')
emptyCorner(xy, by='dd')

adamlilith/legendary documentation built on July 28, 2023, 8:13 p.m.