Calculate the density of samples along a 2-dimensional grid

bin2d(
  x,
  y,
  n.bins = 100,
  x.bin = NA,
  y.bin = NA,
  filter.frac = NA,
  interpolate = TRUE
)

Arguments

x

n by m matrix where n is the number of observations and m is >= 1

y

n by j matrix where n is the number of observations and j is >= 1

n.bins

number bins over which to calculate intervals. Used to calculate x.bin if not provided.

x.bin

vector of bin edges over which to bin.

y.bin

vector of bin edges over which to bin.

filter.frac

Used to beef up sampling for poorly sampled intervals. Interpolates intervals with less than filter.frac coverage.

interpolate

use interpolation? T/F

Value

A list with a matrix of density, x.bin and y.bin