to_spatial: Convert a site-by-variable matrix into a SpatRaster or sf...

View source: R/utils.R

to_spatialR Documentation

Convert a site-by-variable matrix into a SpatRaster or sf object

Description

Convert a site-by-variable matrix into a SpatRaster or sf object

Usage

to_spatial(m, template)

Arguments

m

Matrix or vector.

template

SpatRaster layer with number of cells equal to the number of rows in m, or sf data frame with same number of rows as m.

Value

SpatRaster with a layer for every column in m, or sf data frame with a variable for every column in m, depending on the data type of template.

Examples

ps <- moss()
to_spatial(ps$comm[, 1:5], ps$spatial)

phylospatial documentation built on April 12, 2025, 1:35 a.m.