readr icon indicating copy to clipboard operation
readr copied to clipboard

Request: Clearer error message when guess_max is too low

Open ADraginda opened this issue 9 years ago • 2 comments

I've read the logic as to why guess_max is set at 1000 by default. But could we get a clearer warning when we have more records than guess_max?

temp_file <- tempfile()
x <- dplyr::data_frame(x = 10, y = c(1:9, 1.1))
readr::write_csv(x, temp_file)
readr::read_csv(temp_file)

gives the warning

Warning: 1 parsing failure.
row # A tibble: 1 x 5 col     row   col               expected actual expected   <int> <chr>                  <chr>  <chr> actual 1    10     y no trailing characters     .1 file # ... with 1 more variables: file <chr>

Maybe I'm supposed to be able to parse that, but it's not really clear to me. It would be more useful to get some warning that guess_max was too low

Depending on the size of your data and guess_max, you can also get the additional warning

Warning message:
In rbind(names(probs), probs_f) :
  number of columns of result is not a multiple of vector length (arg 1)

Reproducible: (I was using this to test around with guess_max)

temp_file <- tempfile()
x <- dplyr::data_frame(x = 1:1e7, y = c(1:(1e7 - 1), 1.1))
readr::write_csv(x, temp_file)
y <- readr::read_csv(temp_file, guess_max = 10)

ADraginda avatar Dec 05 '17 08:12 ADraginda

Thanks, this is already fixed in the devel version of readr.

jimhester avatar Dec 05 '17 17:12 jimhester

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

lock[bot] avatar Sep 25 '18 15:09 lock[bot]