encode_field_values: Set coded values for FeatureLayer or Table data frame

View source: R/arc-read.R

encode_field_valuesR Documentation

Set coded values for FeatureLayer or Table data frame

Description

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() or arc_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 the call argument of abort() for more information.

Value

A data.frame with fields encoded with their respective domains.

Examples


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"
)
encoded <- encode_field_values(res, layer)
table(encoded$RESPAGCY)


arcgislayers documentation built on April 16, 2025, 1:10 a.m.