as.matrix returns all values of a Raster* object as a matrix. For RasterLayers, rows and columns in the matrix represent rows and columns in the RasterLayer object. For other Raster* objects, the matrix returned by as.matrix has columns for each layer and rows for each cell.
as.array returns an array of matrices that are like those returned by as.matrix for a RasterLayer
If there is insufficient memory to load all values, you can use getValues or getValuesBlock to read chunks of the file.
Usage
as.matrix(x, ...)
as.array(x, ...)
Arguments
x
Raster* object
...
Additional arguments.
maxpixels Integer. To regularly subsample very large objects