lawn_average: Average of a field among points within polygons

Description Usage Arguments Value See Also Examples

View source: R/average.R

Description

Calculate the average value of a field for a set of data-Points within a set of data-Polygons

Usage

1
lawn_average(polygons, points, in_field, out_field = "average", lint = FALSE)

Arguments

polygons

A data-FeatureCollection of data-Polygon's

points

A data-FeatureCollection of data-Point's

in_field

(character) The field in the points feature from which to pull values to average.

out_field

(character) The field in polygons to put results of the averages.

lint

(logical) Lint or not. Uses geojsonhint. Takes up increasing time as the object to get linted increases in size, so probably use by default for small objects, but not for large if you know they are good geojson objects. Default: FALSE

Value

Polygons with the value of out_field set to the calculated averages

See Also

Other aggregations: lawn_collect(), lawn_count(), lawn_deviation(), lawn_max(), lawn_median(), lawn_min(), lawn_sum(), lawn_variance()

Examples

1
2
3
4
5
6
7
8
## Not run: 
# using data in the package
cat(lawn_data$points_average)
cat(lawn_data$polygons_average)
lawn_average(polygons = lawn_data$polygons_average,
             points = lawn_data$points_average, 'population')

## End(Not run)

lawn documentation built on Jan. 6, 2021, 5:07 p.m.