Home > Enterprise >  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

Time:04-23

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

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

CodePudding user response:

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.

  • Related