Learn R Programming

lawn (version 0.1.7)

lawn_average: Average of a field among points within polygons

Description

Calculate the average value of a field for a set of data-Point's within a set of data-Polygon's

Usage

lawn_average(polygons, points, field, outputField = "average", lint = FALSE)

Arguments

polygons
Geojson data-Polygon's
points
Geojson data-Point's
field
(character) The field in the points features from which to pull values to average
outputField
(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 outField set to the calculated averages

See Also

Other aggregations: lawn_aggregate, lawn_count, lawn_deviation, lawn_max, lawn_median, lawn_min, lawn_sum, lawn_variance

Examples

Run this code
# 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')

Run the code above in your browser using DataLab