embedded: spatial-lag embedding

embeddedR Documentation

spatial-lag embedding

Description

spatial-lag embedding

Usage

## S4 method for signature 'sf'
embedded(
  data,
  target,
  E = 3,
  tau = 1,
  style = 1,
  stack = FALSE,
  detrend = FALSE,
  nb = NULL
)

## S4 method for signature 'SpatRaster'
embedded(
  data,
  target,
  E = 3,
  tau = 1,
  style = 1,
  stack = FALSE,
  detrend = FALSE,
  grid.coord = TRUE,
  embed.direction = 0
)

Arguments

data

observation data.

target

name of target variable.

E

(optional) embedding dimensions.

tau

(optional) step of spatial lags.

style

(optional) embedding style (0 includes current state, 1 excludes it).

stack

(optional) whether to stack embeddings.

detrend

(optional) whether to remove the linear trend.

nb

(optional) neighbours list.

grid.coord

(optional) whether to detrend using cell center coordinates (TRUE) or row/column numbers (FALSE).

embed.direction

(optional) direction selector for embeddings (0 returns all directions, 1-8 correspond to NW, N, NE, W, E, SW, S, SE).

Value

A matrix (when stack is FALSE) or list

Examples

columbus = sf::read_sf(system.file("case/columbus.gpkg",package="spEDM"))
v = spEDM::embedded(columbus,"crime")
v[1:5,]

npp = terra::rast(system.file("case/npp.tif",package="spEDM"))
r = spEDM::embedded(npp,"npp")
r[which(!is.na(r),arr.ind = TRUE)[1:5],]


spEDM documentation built on Sept. 9, 2026, 5:07 p.m.