Skip to content

error received in some functions if there is 0 data to un-nest #19

@sarahollis

Description

@sarahollis

@joshwlambert we have come across this issue before and not sure how to fix it...
i.e. if no contacts have vaccines, an error is thrown when you try to run

cases_vacc_history_clean <- clean_case_vax_history(cases,language_tokens)

after i added at least 1 vaccine to a contact, it ran fine, but before i got this error:

> contacts_vacc_history_clean <- clean_contact_vax_history(contacts,language_tokens)
Error in `tbl_at_vars()`:
! Can't subset columns that don't exist.
✖ Column `vaccinesreceived_date` doesn't exist.
Run `rlang::last_trace()` to see where the error occurred.

it may not be always evident to the analyst what the data contains etc - so is there a way to insert into some of these functions as a safeguard that if there is no data, just proceed with an empty data frame or skip that function and move to the next?

cc @jamesfuller-cdc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions