So I find myself needing to apply global Moran's I across ~20 variables (as in ~20 instances of univariate autocorrelation for each variable, not attempted multivariate spatial autocorrelation). I'm using R and the sf + spdep packages.
data_lisa is a sf object structured:
id | var_a | var_b | ... | var_n | geometry
lw the spatial weights list created with:
lw <- nb2listw(neighbours = poly2nb(data_lisa, queen = TRUE), style = "W", zero.policy = TRUE)
Using spdep, I can apply global Moran's I for a single variable as:
moran.mc(data_lisa$var_a, listw = lw, nsim = 999, zero.policy = TRUE)
...and receive all the expected results.
So I'm looking for help in how to programmatically apply this function across all of my variables.
The result of
moran.mc is a list object which I suspect is where I'm encountering the greatest issues, as I don't have much experience interacting with lists.
Ideally the output would look something like this.
How can I do this?