sf into a
spm object (Internal use)
single_sf_to_spm( sf_obj, n_pts, type = "regular", by_polygon = FALSE, poly_ids = NULL, var_ids = NULL, trunc_d = NULL ) sf_to_spm( sf_obj, n_pts, type = "regular", by_polygon = FALSE, poly_ids = NULL, var_ids = NULL, trunc_d = NULL )
sfobject s.t. its geometries are polygons.
numericscalar representing the number of points to create a grid in the study region on which the polygons in
sf_objis observed. Alternatively, it can be a vector of the same length as
nrow(sf_obj). In this case, it generates the given number of points for each polygon in
characterindicating the type of grid to be generated. The options are
c("random", "regular", "hexagonal"). For more details, see
logicalindicating wheter we should generate
n_ptsby polygon or for the
n_ptsfor the whole study region.
charactervector informing the name of the variable in
sf_objthat represents the polygons unique identifiers. In case this is not informed, we assume the id of the polygons are given by their row numbers.
a scalar or vector of type
characterindicating the (numerical) variables that are going to be analyzed.
truncation distance for grid points. Consider using half of the maximum distance between polygons
list of size 6 belonging to the class
spm. This list stores all the objects necessary to fit models
data(liv_lsoa) # loading the LSOA data msoa_spm <- sf_to_spm(sf_obj = liv_msoa, n_pts = 1000, type = "regular", by_polygon = FALSE, poly_ids = "msoa11cd", var_ids = "leb_est")