Support use of field alias values as column names or label attributes by arc_read()
#169
Labels
enhancement
New feature or request
arc_read()
#169
Is your feature request related to a problem? Please describe.
When used by the creator of a FeatureLayer, field aliases often provide key information about meaning of otherwise confusing field names. These aliases could be used as names for the resulting sf object or as field labels (using the same attribute used by the
{labelled}
package).arc_read()
already has partial support for this whencol_names = "alias"
but this inadvertently created a bug where you can never rename an attribute to "alias" if it is a single column data frame.Describe the solution you'd like
I'm adding the proposed solution to the open PR: #167 since it also includes fixes to other aspects of
arc_read()
. In the PR, the internalset_layer_names
function has been renamedset_layer_col_names()
and exposes a new "alias" parameter that enables users to drop, replace, or label existing column names using the alias values. Note, there is never an alias for the geometry column (as far as I can tell) so there is never a labelled assigned to geometry.Describe alternatives you've considered
This could be done using the
{labelled}
package but keeping the function internal allows for a much more minimal implementation. It could potentially benefit from an alert when column names and alias values are identical but this is very very common so may not be worth it.You could also allow users to pass labels through a separate argument and get field labels but optionally replace all or some of the the alias values. This may be better handled as a separate option if the function is exported and available for users outside of
arc_read()
alone.Additional context
Handling alias values has some similarities to the interest in improving the handling of domain values #134
It is also possible this should be included in arcgisutils package instead as a helper function related to
parse_esri_json()
orfetch_layer_metadata()
or the proposedarc_meta()
function #163The text was updated successfully, but these errors were encountered: