discretization_method
model elementsR/accessors-methods-discret_method.R
accessors-methods-discret_method.Rd
All methods described here allow to access the elements of contained in objects of class discretization_method.
method_func(sspm_object)
# S4 method for class 'discretization_method'
method_func(sspm_object)
method_func(object) <- value
# S4 method for class 'discretization_method'
method_func(object) <- value
# S4 method for class 'discretization_method'
spm_name(sspm_object)
# S4 method for class 'discretization_method'
spm_name(object) <- value
[discretization_method] An object of class discretization_method.
[discretization_method] An object of class discretization_method.
typically an array-like R object of a similar class as
x
.
The object in the required slot.
method <- as_discretization_method("tesselate_voronoi")
method_func(method)
#> function (boundaries, with, boundary = "sfa", sample_surface = FALSE,
#> sample_points = TRUE, nb_samples = NULL, min_size = 1500,
#> stratify = TRUE, seed = 1)
#> {
#> check_spatial_inputs(boundaries, sample_surface, sample_points,
#> boundary, nb_samples, min_size, seed)
#> nb_samples <- check_nb_samples_formatting(nb_samples, boundaries,
#> boundary)
#> if (sample_surface) {
#> voronoi_points <- sample_points(mode = "surface", with,
#> boundaries, boundary, nb_samples, seed)
#> }
#> else {
#> if (sample_points) {
#> voronoi_points <- sample_points(mode = "points",
#> with, boundaries, boundary, nb_samples, seed)
#> }
#> else {
#> stopifnot(sf::st_is(with, "POINT"))
#> voronoi_points <- suppressMessages(sf::st_join(with,
#> boundaries, suffix = c("", "_duplicate"))) %>%
#> dplyr::filter(!is.na(eval(dplyr::sym(boundary))))
#> }
#> }
#> voronoi <- make_patches_voronoi(stratify, voronoi_points,
#> boundaries, boundary)
#> voronoi <- merge_small_polygons(voronoi, min_size, boundary)
#> voronoi <- cleanup_polygons(voronoi, boundary)
#> return(list(patches = voronoi, points = voronoi_points))
#> }
#> <bytecode: 0x5599ea5da990>
#> <environment: namespace:sspm>