Learn R Programming

lawn (version 0.5.0)

lawn_collect: Collect method

Description

Given an inProperty on points and an outProperty for polygons, this finds every point that lies within each polygon, collects the inProperty values from those points, and adds them as an array to outProperty on the polygon.

Usage

lawn_collect(polygons, points, in_field, out_field, lint = FALSE)

Arguments

polygons
in_field

(character) the field in input data to analyze

out_field

(character) the field in which to store results

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

A FeatureCollection of data-Polygon features with properties listed as out_field

See Also

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

Examples

Run this code
# NOT RUN {
ex_polys <- lawn_data$polygons_aggregate
ex_pts <- lawn_data$points_aggregate
res <- lawn_collect(ex_polys, ex_pts, 'population', 'stuff')
res$type
res$features
res$features$properties

# }
# NOT RUN {
lawn_collect(ex_polys, ex_pts, 'population', 'stuff') %>% view
# }

Run the code above in your browser using DataLab