Skip to contents

Given a dataframe of numeric values and a spatial weights matrix, calculate the spatial lag of each variable.

Usage

make_wx(x, listw, order = NULL)

Arguments

x

a data.frame of independent variables generated with make_x().

listw

a listw object generated with sim_grid_listw().

order

unused.

Value

A data.frame of the spatially lagged variables.

Examples

listw <- sim_grid_listw(10, 10)
x_vars <- make_x(100, mu = c(0.5, 1.2), var = c(1, 0.5)) 
res <- make_wx(x_vars, listw)
head(res)
#>     x_1_lag  x_2_lag
#> 1 1.2290535 1.768049
#> 2 1.0438814 1.362660
#> 3 0.9831329 1.451715
#> 4 1.4456114 1.341241
#> 5 1.7252607 1.709389
#> 6 2.2597195 1.615532