Learn R Programming

lawn (version 0.1.7)

lawn_reclass: Reclassify properties data

Description

Takes a data-FeatureCollection, an input field, an output field, and an array of translations and outputs an identical FeatureCollection with the output field property populated

Usage

lawn_reclass(input, inField, outField, translations, lint = FALSE)

Arguments

input
Set of input features
inField
the field to translate
outField
the field in which to store translated results
translations
an array of translations. Use nested lists instead of vectors as combined numerics and characters will become all character strings when converted to json. Each list within the nested list of length 3, of the form , ,
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 data-FeatureCollection with identical geometries to input but with outField populated.

See Also

Other classification: lawn_jenks, lawn_nearest, lawn_quantile

Examples

Run this code
t1 <- list(list(0, 200, "small"), list(200, 400, "medium"), list(400, 600, "large"))
lawn_reclass(lawn_data$points_average, 'population', 'size', t1)
lawn_reclass(lawn_data$points_average, 'population', 'number', t1)

t2 <- list(list(0, 150, "small"), list(150, 700, "big"))
lawn_reclass(lawn_data$points_average, 'population', 'size', t2)

Run the code above in your browser using DataLab