I am able to read in a subset of columns defined in cols_only
like so:
x <- read_csv(filePath, col_types=cols_only(colA=col_character())
x <- read_csv(filePath, col_types=cols_only(colA='c'))
Both work fine, but I tried to create a list to pass into cols_only
and splice it, like I do in many Tidyverse functions, but this one generates an error.
cols <- list(colA='c')
x <- read_csv(filePath, col_types=cols_only(!!!cols))
I tried this also as a named vector cols <- c(colA='c')
but I get the error Error in !cols: invalid argument type
.
Is this a limitation of the function? I saw this GitHub issue https://github.com/tidyverse/readr/issues/971 so was hoping this function could support this functionality.