readr
readr copied to clipboard
Bring back stringsAsFactors?
I know R's read.csv stringsAsFactors option has caused a lot of confusion over the years, but I think it is a genuinely useful option to have (defaulting to FALSE). Most of the data I work with has categorical data in CSV (which has everything as strings), and the current solution is to use dplyr mutate/across/where to change many columns at once, which is ok but could be nicer handled at the data input stage. AFAIK col_types doesn't have a cols guess_strings_as_factors option.
Stack Overflow request to show it is a real-world problem https://stackoverflow.com/questions/40367163/importing-unquoted-strings-as-factors-using-read-csv-from-the-readr-package-in-r