Skip to content

Argument to handle "unspecified" fields #39

@mgirlich

Description

@mgirlich

Given an object to tibblify and a specification for this there might be some fields that are not specified. Now, this could be because:

  • you don't care about these additional fields
  • an optional field has changed the name or there are new fields
  • some fields simply vary

The specification should help to clarify what's the case (a bit similar to readr::cols() vs. readr::cols_only()). Therefore, the spec should get these arguments:

  • unspecified_fields = c("inform", "warn", "error", "ignore", "collect")
    • "ignore" implies that you know there are (or might be) other fields but you deliberately ignore them
    • "error" implies that you don't expect other fields, e.g. useful when getting data from an API and storing it
    • "inform"/"warn" not sure if both are needed
  • unspecified_fields_to is a string specifying the column name where unspecified fields should end up in (similar to tib_multi() How to handle fields whose specification cannot be guessed? #38).
  • known_fields to specify the keys of other fields you know exist but you decide to ignore

Things to consider

  • a known field is always optional
  • a field can be in known_fields and have a specification
  • allow known_fields to be a list so that they can be used for nested keys as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions