point_calc {extRatum}R Documentation

Point data calculation

Description

Computes three different summary statistics: (1) TotalArea total area of each polygon; (2) NoPoints number of multipoint objects within a given polygon; and, (3) Ratio ratio between NoPoints and TotalArea covered within a polygon.

Usage

point_calc(
  point_data,
  higher_geo_lay,
  unique_id_code,
  class_col,
  crs,
  total_points = TRUE
)

Arguments

point_data

multipoint object of class sf, sfc or sfg.

higher_geo_lay

multipolygon object of class sf, sfc or sfg.

unique_id_code

a string; indicating a unique ID column of higher_geo_lay, used as the summary areas.

class_col

a string; indicating a column name for point_data containing information on a target point classification. This is used when total_points = FALSE.

crs

coordinate reference system: integer with the EPSG code, or character based on proj4string.

total_points

logical; if the target is to measure the total number of points set to TRUE, by setting to FALSE, it returns the total number of points by class. If missing, it defaults to TRUE.

Details

The function requires two sets of data: a layer of geographic polygons, and a layer of points

If points have been categorised into classes, the function can return the same summary measures for each class if total_points = FALSE by specifying the column that contains the classification in class_col

Value

if total_points = TRUE: A tibble data frame objects containing four columns is returned:

if total_points = FALSE: A list of three tibble data frame objects is returned.

Examples

## Run point_calc() using the packages' dummy data sets.
## The data sets are georeferenced on wgs84. However, a planar system is used to measure areas.
## For the examples provided here, points and polygons relate to the United Kingdom.
## So the British National Grid is used.

## Not run:
## This example returns the total points count and ratio
# outcome1 <- point_calc(
# point_data = points,
# higher_geo_lay = pol_large,
# unique_id_code = "large_pol_",
# crs = "epsg:27700",
# total_points = TRUE)



## This example returns the points count and ratio by class
# outcome2 <- point_calc(
# point_data = points,
# higher_geo_lay = pol_large,
# unique_id_code = "large_pol_",
# class_col = "class_name",
# crs = "epsg:27700",
# total_points = FALSE)
## End(Not run)



[Package extRatum version 1.0.4 Index]