knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of declusteringr is to declustering spatial data.
This package offers support for the sf
spatial objects.
You can install the development version of declusteringr with:
# install.packages("remotes") remotes::install_github("alsarna/declusteringr")
Let's start with reading the data:
library(sf) points4 = sf::st_read(system.file("points/punkty4.shp", package = "declusteringr"))
This is a basic example of cell declustering:
library(declusteringr) x = declstr_weighted(spatial_object = points4, cellsize = 10000) x
Plot input data and weighted points:
par(mfrow = c(1, 2)) plot(st_geometry(points4), main = "original data") plot(x["received_weights"], main = "cell declustering", key.pos = NULL, reset = FALSE)
declstr_weighted()
is adding the following columns: received_weights
- the weight of each cell, and lengths
- a number of points in cell.
declstr_weighted()
does not change the number of features.
Weights are calculated according to the equation:
, where n~i~ is the number of samples in the cell in which sample j is located and n is the total number cells with samples.
This is basic example of random declustering:
y = declstr_random(spatial_object = points4, cellsize = 10000, numpoint = 2) y
Plot input data and data after random declustering:
par(mfrow = c(1, 2)) plot(st_geometry(points4), main = "original data") plot(y, main = "random declustering", key.pos = NULL, reset = FALSE)
declstr_random()
is choosing random features by specifying some parameters.
declstr_random()
can change the number of features.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.