xyTable {grDevices}R Documentation

Multiplicities of (x,y) Points, e.g., for a Sunflower Plot

Description

Given (x,y) points, determine their multiplicity – checking for equality only up to some (crude kind of) noise. Note that this is special kind of 2D binning.

Usage

xyTable(x, y = NULL, digits)

Arguments

x, y

numeric vectors of the same length; alternatively other (x, y) argument combinations as allowed by xy.coords(x, y).

digits

integer specifying the significant digits to be used for determining equality of coordinates. These are compared after rounding them via signif(*, digits).

Value

A list with three components of same length,

x

x coordinates, rounded and sorted.

y

y coordinates, rounded (and sorted within x).

number

multiplicities (positive integers); i.e., number[i] is the multiplicity of (x[i], y[i]).

Note

Missing values in the coordinates are counted towards the multiplicities. The sum of the multiplicities will equal the number of coordinates.

See Also

sunflowerplot which typically uses xyTable(); signif.

Examples

xyTable(iris[, 3:4], digits = 6)

## If missing coordinates exist, they are also counted
iris2 <- iris[1:10, 3:4]
iris2[4, 2] <- NA
iris2[c(3, 5), ] <- NA
xyTable(iris2)

## Discretized uncorrelated Gaussian:

xy <- data.frame(x = round(sort(stats::rnorm(100))), y = stats::rnorm(100))
xyTable(xy, digits = 1)

[Package grDevices version 4.5.0 Index]