-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't cast <logical> to <vctrs_unspecified> in tibbles? #800
Comments
to circumvent r-lib/vctrs#800 closes #91
I think there are two issues here. I'll give this a shot tomorrow The first is that if the C library(dplyr, warn.conflicts = FALSE)
library(vctrs)
# wrong
vec_ptype(tibble(x = 2, y = NA))
#> # A tibble: 0 x 2
#> # … with 2 variables: x <dbl>, y <lgl>
# correct
as_tibble(vec_ptype(data.frame(x = 2, y = NA)))
#> # A tibble: 0 x 2
#> # … with 2 variables: x <dbl>, y <???> Once that is fixed, then these two should have the same results. This mimics what library(dplyr, warn.conflicts = FALSE)
library(vctrs)
# vec_ptype_common(dplyr::tibble(x = 1), dplyr::tibble(x = 2, y = NA))
# but before the finalize is run
vec_ptype2(
vec_ptype2(NULL, dplyr::tibble(x = 1)),
dplyr::tibble(x = 2, y = NA)
)
#> # A tibble: 0 x 2
#> # … with 2 variables: x <dbl>, y <???>
# vec_ptype_common(dplyr::tibble(x = 2, y = NA), dplyr::tibble(x = 1))
# but before the finalize is run
vec_ptype2(
vec_ptype2(NULL, dplyr::tibble(x = 2, y = NA)),
dplyr::tibble(x = 1)
)
#> # A tibble: 0 x 2
#> # … with 2 variables: x <dbl>, y <lgl> The second problem is with library(dplyr, warn.conflicts = FALSE)
library(vctrs)
internal_common_type <- vec_ptype2(
vec_ptype2(NULL, dplyr::tibble(x = 1)),
dplyr::tibble(x = 2, y = NA)
)
internal_common_type
#> # A tibble: 0 x 2
#> # … with 2 variables: x <dbl>, y <???>
vec_ptype_finalise(internal_common_type)
#> # A tibble: 0 x 2
#> # … with 2 variables: x <dbl>, y <???> |
Agreed finalisation should be recursive over data frames. |
to circumvent r-lib/vctrs#800 closes #91
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.If using e.g. an integer NA it works as expected. Same for logical NA in a base R data frame:
The text was updated successfully, but these errors were encountered: