Learn R Programming

WSGeometry (version 1.2.1)

bin2d: Bin data onto a grid.

Description

Bin data onto a equidistant grid in [0,1]^2.

Usage

bin2d(data.pos, data.weights, gridsize, turn = FALSE)

Arguments

data.pos

A Mx2 matrix specifying the positions of the data measure.

data.weights

A list of vectors of the same size as the number of rows in data.pos. All entries in the vector must be non-negative and the entries in the vector must sum to one.

gridsize

A vector of two integers specifying the dimensions of the grid, which the data should be binned to.

turn

A boolean specifying whether the output should be rotated to keep the previous orientation when the matrix is plotted with the image function.

Value

A matrix containing the weights of the measure in each bin.