The appropriate context of the cols_only
argument is to spell out the columns you want to specifically read in as well as the type you would like to assign to the column.
Example:
data<-read_csv("blah.csv",
n_max=100,
col_types = cols_only(
pumkins = col_factor(c("Hooligan", "Cinderella", "Big Max")),
weight = col_double()
))
In this case I had it open the two columns named pumpkins and weight assigning each a type and in the case of pumpkins, factor levels. cols_only
will accept a list, but the list as formatted above. You can place as many or as few column names and type descriptors in that list as you like.
If you want to just drop in a letter, then you can set it equal this way:
c<-cols_only(
pumkins = col_factor(c("Hooligan", "Cinderella", "Big Max")),
weight = col_double())
Then drop c in straight up:
data <- read_csv("blah.csv",
n_max = 100,
col_types = c)
)