knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

declusteringr

The goal of declusteringr is to declustering spatial data. This package offers support for the sf spatial objects.

Installation

You can install the development version of declusteringr with:

# install.packages("remotes")
remotes::install_github("alsarna/declusteringr")

Examples

Let's start with reading the data:

library(sf)
points4 = sf::st_read(system.file("points/punkty4.shp", package = "declusteringr"))

Cell declustering

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:

pattern

, 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.

Random declustering

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.

References

  1. Declustering and Debiasing - M. J. Pyrcz (mpyrcz@ualberta.ca) and C. V. Deutsch (cdeutsch@ualberta.ca), Centre for Computational Geostatistics University of Alberta, Edmonton, Alberta, CANADA
  2. Cell Declustering Parameter Selection - C. V. Deutsch
  3. Nowosad, J., (2019). Geostatystyka w R. Poznań: Space A. ISBN 978-83-953296-0-9. Online: https://bookdown.org/nowosad/Geostatystyka/
  4. Nowosad, J., (2019). Elementarz programisty: wstęp do programowania używając R. Poznań: Space A. Online: https://nowosad.github.io/elp/
  5. Lovelace, Robin & Nowosad, Jakub & Muenchow, Jannes. (2019). Geocomputation with R. 10.1201/9780203730058.
  6. R Packages, H. Wickham, J. Bryan. Online: https://r-pkgs.org/ (2015)


alsarna/declusteringr documentation built on Sept. 29, 2020, 11:59 p.m.