fmap_stats: Summary Stats from the Fresnel Map

View source: R/fmap_stats.R

fmap_statsR Documentation

Summary Stats from the Fresnel Map

Description

Function for calculating summary statistics from Fresnel Maps, or thematic maps that visualise spatial data to the level of equal-area concentric circular zones (or annuli).

Usage

fmap_stats(
  ncircles,
  radius_inner = NULL,
  radius_outer = NULL,
  geo_points,
  lat = NULL,
  lon = NULL,
  geo_centre = NULL,
  geo_centres = NULL,
  id_var = NULL,
  sum = NULL,
  mean = NULL,
  median = NULL,
  count = F
)

Arguments

ncircles

Number of concentric circular zones of equal area (i.e. Fresnel circles) including the inner circle and annuli

radius_inner

Radius of innermost Fresnel circle in metres

radius_outer

Radius of outermost Fresnel circle in metres

geo_points

A spatial dataset of points to aggregate

lat

Latitude of the centre of the Fresnel Map

lon

Longitude of the centre of the Fresnel Map

geo_centre

A spatial dataset containing the coordinates of the centre of the Fresnel Map

geo_centres

A spatial dataset containing the coordinates of the centres of each separate Fresnel Map

id_var

Variable from geo_centres containing the location ID

sum

Variable from geo_points for calculating sum

mean

Variable from geo_points for calculating mean

median

Variable from geo_points for calculating median

count

Count the number of points from geo_points. Input TRUE to count points. Defaults to FALSE

Value

Summary statistics from the Fresnel Map based on aggregated data from the Fresnel circles.

Examples

library(sf)
library(dplyr)

# Load the sf datasets of cholera deaths and Soho pumps
data(cholera_deaths, soho_pumps)

# Filter the Broad Street Pump from the Soho pumps dataset
bstreet_pump <- soho_pumps %>% filter(soho.pump == "Broad Street")

# Summary stats from the Fresnel Map for the Broad Street Pump
fmap_stats(radius_inner = 125, ncircles = 8, geo_centre = bstreet_pump, geo_points = cholera_deaths, sum = "cholera.deaths")

# Summary stats from multiple Fresnel Maps based on each Soho pump
fmap_stats(radius_outer = 150, ncircles = 2, geo_centres = soho_pumps, id_var = "soho.pump", geo_points = cholera_deaths, sum = "cholera.deaths")

lbuk/fmap documentation built on Nov. 23, 2024, 12:47 p.m.