The sum of all observations within a circle of a certain radius.

concentration(
  sub,
  full,
  value,
  lon_sub = lon,
  lat_sub = lat,
  lon_full = lon,
  lat_full = lat,
  radius = 200,
  display_progress = TRUE
)

Arguments

sub

data.frame of locations to calculate concentration risk for (target points). sub should include at least columns for longitude and latitude.

full

data.frame to find the locations within radius r from locations in sub (reference locations). full should include at least columns for longitude, latitude and value of interest to summarize.

value

column name with value of interest to summarize in full.

lon_sub

column name in sub with longitude (lon is default).

lat_sub

column name in sub with latitude (lat is default).

lon_full

column name in full with longitude in full (lon is default).

lat_full

column name in full with latitude in full (lat is default).

radius

radius (in meters) (default is 200m).

display_progress

show progress bar (TRUE/FALSE). Defaults to TRUE.

Value

A data.frame equal to data.frame sub including an extra column concentration.

Author

Martin Haringa

Examples

df <- data.frame(location = c("p1", "p2"), lon = c(6.561561, 6.561398), lat = c(53.21369, 53.21326))
concentration(df, Groningen, value = amount, radius = 100)
#>   location      lon      lat concentration
#> 1       p1 6.561561 53.21369           775
#> 2       p2 6.561398 53.21326          2271