Skip to content

vec_case_when() type issue with NA and default = <character> #2094

@DavisVaughan

Description

@DavisVaughan
vctrs::vec_case_when(
  conditions = list(TRUE),
  values = list(NA),
  default = "a"
)
#> Error in `vctrs::vec_case_when()`:
#> ! Can't combine <logical> and `default` <character>.

vctrs::vec_ptype2(NA, "a")
#> character(0)

I think this is because we do vec_ptype_common() of values which gives logical() which we then combine against default, but logical() doesn't look unspecified() so it errors.

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