rtidyversereadr

In readr()/read_csv, how to import data with all columns as character


In readr()/read_csv, how to import data with all columns as character? Thanks!

library(tidyverse)    
read_csv(readr_example("mtcars.csv")))

Solution

  • You can pick a default column type using:

    read_csv(readr_example("mtcars.csv"), col_types = cols(.default = col_character()))

    The cols specification will also let you define specific columns as well.