Learn R Programming

starsExtra (version 0.2.8)

matrix_to_stars: Convert matrix to stars

Description

Converts matrix to a single-band stars raster, conserving the matrix orientation where rows become the y-axis and columns become the y-axis. The bottom-left corner of the axis is set to (0,0) coordinate, so that x and y coordinates are positive across the raster extent.

Usage

matrix_to_stars(m, res = 1)

Value

A stars raster

Arguments

m

A matrix

res

The cell size, default is 1

Examples

Run this code
data(volcano)
r = matrix_to_stars(volcano, res = 10)
plot(r)

Run the code above in your browser using DataLab