Skip to content

producing a column specification for type_convert() #517

@jennybc

Description

@jennybc

I'm learning the hard way that readr::type_convert() no longer takes column specifications as a character string, like cccnnn. Apparently I do this in googlesheets examples, tests, etc. Is there a specific reason to require the long form in type_convert()? If I have to workaround this myself, is there a better way than what I've got here? This looks a bit nutty.

x <- "cccnnn"
do.call(readr::cols, as.list(strsplit(x, "")[[1]]))
#> cols(
#>    = col_character(),
#>    = col_character(),
#>    = col_character(),
#>    = col_number(),
#>    = col_number(),
#>    = col_number()
#> )

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorread 📖

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions