world2spatRast: Convert a 'worldMatrix' or 'worldArray' object into a...

world2spatRastR Documentation

Convert a worldMatrix or worldArray object into a SpatRaster object

Description

Convert a worldMatrix object or a worldArray object into a SpatRaster object

Usage

world2spatRast(world)

## S4 method for signature 'worldMatrix'
world2spatRast(world)

## S4 method for signature 'worldArray'
world2spatRast(world)

Arguments

world

WorldMatrix or worldArray object.

Details

The SpatRaster returned has the same extent and resolution as the world with round coordinates at the center of the cells and coordinates x.5 at the edges of the cells.

Value

SpatRaster object. Patches value are retained from the world.

Author(s)

Sarah Bauduin

Examples

w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9, data = runif(100))
r1 <- world2spatRast(w1)
terra::plot(r1)

w2 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9, data = 0)
w3 <- stackWorlds(w1, w2)
r3 <- world2spatRast(w3)
terra::plot(r3)


PredictiveEcology/NetLogoR documentation built on Jan. 31, 2024, 9:31 p.m.