raster_to_matrix: Convert raster stack to matrix

View source: R/formatting.R

raster_to_matrixR Documentation

Convert raster stack to matrix

Description

Given a raster stack with layer names, and a vector of names to extract from that raster stack, use the raster::getValues() function to extract the values from each layer and put each flattened layer in the column of a matrix.

Usage

raster_to_matrix(r, rnames)

Arguments

r

Raster stack with layer names

rnames

Vector of names from the raster stack

Value

Numeric matrix with column names matching rnames


BIO-RSG/oceancolouR documentation built on Nov. 3, 2024, 2:03 a.m.