R: Raster to Matrix

raster_to_matrix {rayshader} | R Documentation

## Raster to Matrix

### Description

Turns a raster into a matrix suitable for rayshader.

### Usage

    raster_to_matrix(raster, verbose = interactive())

### Arguments

`raster` | The input raster. Either a RasterLayer object, or a filename.
`verbose` | Default 'interactive()'. Will print dimensions of the resulting matrix.

### Examples

    #Save montereybay as a raster and open using the filename.

    temp_raster_filename = paste0(tempfile(),".tif")
    raster::writeRaster(raster::raster(t(montereybay)),temp_raster_filename)
    elmat = raster_to_matrix(temp_raster_filename)
    elmat %>%
     sphere_shade() %>%
     plot_map()

[Package rayshader version 0.19.2 Index]