Learn R Programming

starsExtra (version 0.2.8)

layer_to_vector: Get stars layer values as vector

Description

Extracts the values of a single layer in a stars object to a vector. Cell values are ordered from top-left corner to the right.

Usage

layer_to_vector(x, check = TRUE)

Value

A vector with cell values, ordered by rows, starting from the top left corner (north-west) and to the right.

Arguments

x

A raster (class stars) with two dimensions: x and y, i.e., a single-band raster.

check

Whether to check (and fix if necessary) that input has one attribute, one layer and x-y as dimensions 1-2 (default is TRUE).

Examples

Run this code
data(dem)
v = layer_to_vector(dem)
v

Run the code above in your browser using DataLab