encode_field_values()
can replace column values based on codedValue
type field domains from a corresponding Table
or FeatureLayer
object
created with arc_open()
.
Usage
encode_field_values(
.data,
.layer,
field = NULL,
codes = c("replace", "label"),
call = rlang::caller_env()
)
Arguments
- .data
A data frame returned by
arc_select()
orarc_read()
.- .layer
A Table or FeatureLayer object. Required.
- field
Default
NULL
. Field or fields to replace. Fields that do not have coded value domains are ignored.- codes
Use of field alias values. Defaults to
"replace"
. There are two options:"replace"
: coded values replace existing column values."label"
: coded values are applied as value labels via a"label"
attribute.
- call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.
Examples
# \donttest{
layer <- arc_open(
"https://geodata.baltimorecity.gov/egis/rest/services/Housing/dmxOwnership/MapServer/0"
)
res <- arc_select(
layer,
n_max = 100,
where = "RESPAGCY <> ' '",
fields = "RESPAGCY"
)
#> Registered S3 method overwritten by 'jsonify':
#> method from
#> print.json jsonlite
encoded <- encode_field_values(res, layer)
table(encoded$RESPAGCY)
#>
#> Education NPA/HCD Tax Sales
#> 4 83 13
# }