sim.space: Simulate attribute space data for RAP

View source: R/sim.space.R

sim.spaceR Documentation

Simulate attribute space data for RAP

Description

This function simulates attribute space data for RAP.

Usage

sim.space(x, ...)

## S3 method for class 'SpatRaster'
sim.space(x, d = 2, model = 0.2, ...)

## S3 method for class 'SpatialPolygons'
sim.space(x, res, d = 2, model = 0.2, ...)

## S3 method for class 'sf'
sim.space(x, res, d = 2, model = 0.2, ...)

Arguments

x

terra::rast() or sf::st_sf() object delineating the spatial extent for the study area.

...

not used.

d

integer number of dimensions. Defaults to 2.

model

numeric scale parameter for simulating spatially auto-correlated data using Gaussian random fields. Higher values produce patchier data with more well defined clusters, and lower values produce more evenly distributed data. Defaults to 0.2.

res

numeric resolution to simulate distributions. Only needed when sf::st_sf() are supplied.

Value

terra::rast() with layers for each dimension of the space.

Examples

## Not run: 
# simulate planning units
sim_pus <- sim.pus(225L)

# simulate 1d space using SpatRaster
s1 <- sim.space(blank.raster(sim_pus, 1), d = 1)

# simulate 1d space using sf
s2 <- sim.space(sim_pus, res = 1, d = 1)

# simulate 2d space using sf
s3 <- sim.space(sim_pus, res = 1, d = 2)

# plot simulated spaces
par(mfrow = c(2,2))
plot(s1, main = "s1")
plot(s2, main = "s2")
plot(s3[[1]], main = "s3: first dimension")
plot(s3[[2]], main = "s3: second dimension")

## End(Not run)

jeffreyhanson/raptr documentation built on Feb. 3, 2024, 10:56 p.m.