Skip to content
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

as.character(as.col_spec()) fails for data frames with logical columns #1127

Closed
natecobb opened this issue Sep 29, 2020 · 0 comments
Closed

Comments

@natecobb
Copy link

Referencing #895 feature request, which notes that as.col_spec() in the development branch can be used to generate a short/text col spec for existing data frames:

This fails in the current HEAD branch for data frames with logical columns because col_to_short() is missing collector_logical = "l' (I don't see any other missing types):

switch(class(x)[[1]],

Reprex:

library(readr)

# This works
as.character(readr::as.col_spec(mtcars))
#> [1] "ddddddddddd"

# This fails
mtcars2 <- mtcars
mtcars2$gas_guzzler <- mtcars2$mpg < 15
as.character(readr::as.col_spec(mtcars2))
#> Error in vapply(x$cols, col_to_short, character(1)): values must be length 1,
#>  but FUN(X[[12]]) result is length 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant