Generates a spatial weights matrix (A) and sp_id (S). User defines units and adjacencies.
spatial_SA(data, var_ccode, threshold = 800L)
data | data.frame. |
---|---|
var_ccode | name of the variable that contains the country codes. |
threshold | distance in kilometers. By default is 800. |
list. Contains database with variable sp_id (S) and matrix A.
walter <- spduration::add_duration(Walter_2015_JCR,"renewed_war", unitID = "ccode", tID = "year", freq = "year", ongoing = FALSE)#> Warning: Converting to 'Date' class with yyyy-06-30walter <- spatial_SA(data = walter, var_ccode = "ccode", threshold = 800L)