col_types

  • One approach is to tell readr that x is a numeric column using col_types argument:
df <- read_csv(
  simple_csv, 
  col_types = list(x = col_double())
)
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
##   dat <- vroom(...)
##   problems(dat)
  • read_csv() reports that there was a problem, and tells us we can find out more with problems()
problems(df)
## # A tibble: 1 × 5
##     row   col expected actual file                            
##   <int> <int> <chr>    <chr>  <chr>                           
## 1     3     1 a double .      /tmp/RtmpDZgeRV/file18824251bf0d