Skip to content

Friendlier coercion #330

@jonthegeek

Description

@jonthegeek

Summary

As a tibblify user, in order to convert incoming data to the expected form, I would like to accept any value that can reasonably be coerced to the expected value.

Details

Right now, incoming data sometimes fails to tibblify even though it's BASICALLY in the correct format. For example, if data is loaded in as character (by {yaml} or {jsonlite}, for example), but it's supposed to be integer, even "1" won't properly vctrs::vec_cast() to the desired format.

Instead of the strict casting rules of vctrs::vec_cast(), let's instead use the "accept it as long as no information is lost" rules from stbl::to_*().

This also applies to the .fill argument (which might need its own ticket).

TODO: ADD CONCRETE EXAMPLES OF SURPRISING FAILURES

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    toleranceMake coercion to specs work whenever the data makes sense.
    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions