Compute a histogram from xy data given set of breakpoints.

hist_xy(xy, breaks)

## Arguments

xy

Numeric. A data.frame, or object coercible to a data.frame with as.data.frame(), where the columns of the data.frame are, or can be, interpreted as XY coordinates.

breaks

List. A list of vectors, one for each dimension of xy, where each vector gives the breakpoints between the histogram cells.

## Value

A list with three components:

• x The X dimension breakpoints.

• y The Y dimension breakpoints.

• z A frequency table of the number of xy points in each cell.

## Examples

hist_xy(matrix(runif(50), 25), list(seq(0, 1, .2), seq(0, 1, .2)))
#> $x #> [1] 0.0 0.2 0.4 0.6 0.8 1.0 #> #>$y
#> [1] 0.0 0.2 0.4 0.6 0.8 1.0
#>
#> \$z
#>    y
#> x   1 2 3 4 5
#>   1 0 0 0 6 2
#>   2 1 1 0 2 0
#>   3 1 2 1 0 0
#>   4 0 0 2 2 1
#>   5 2 1 1 0 0
#>