Bin data onto a equidistant grid in [0,1]^2.
bin2d(data.pos, data.weights, gridsize, turn = FALSE)
A Mx2 matrix specifying the positions of the data measure.
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.
A vector of two integers specifying the dimensions of the grid, which the data should be binned to.
A boolean specifying whether the output should be rotated to keep the previous orientation when the matrix is plotted with the image function.
A matrix containing the weights of the measure in each bin.