Learn R Programming

rgeoda (version 0.1.0)

spatial_lag: Spatial Lag

Description

Compute the spatial lag for idx-th observation using selected variable and current weights matrix

Usage

spatial_lag(gda_w, df)

Value

A data.frame with one column "Spatial Lag"

Arguments

gda_w

A Weight object

df

A data frame with selected variable only. E.g. guerry["Crm_prs"]

Examples

Run this code
if (FALSE) {
library(sf)
guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda")
guerry <- st_read(guerry_path)
queen_w <- queen_weights(guerry)
crm_lag <- spatial_lag(queen_w, guerry["Crm_prs"])
crm_lag
}

Run the code above in your browser using DataLab