Skip to content

Can't cast <logical> to <vctrs_unspecified> in tibbles? #800

@sebkopf

Description

@sebkopf

The following cast errors but only for logical NA and only for tibbles (see example below). Maybe this is related to #205? Sorry, not familiar enough yet with vctrs, could not figure out why this fails.

vctrs::vec_rbind(
  dplyr::tibble(x = 1), 
  dplyr::tibble(x = 2, y = NA)
)
# Error: Can't cast `y` <logical> to `y` <vctrs_unspecified>.

If using e.g. an integer NA it works as expected. Same for logical NA in a base R data frame:

vctrs::vec_rbind(
    dplyr::tibble(x = 1), 
    dplyr::tibble(x = 2, y = NA_integer_)
)
## A tibble: 2 x 2
#      x     y
#  <dbl> <int>
#1     1    NA
#2     2    NA

vctrs::vec_rbind(
    data.frame(x = 1), 
    data.frame(x = 2, y = NA)
)
#   x  y
#1 1 NA
#2 2 NA

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