Readr functions will only throw an error if parsing fails in an unrecoverable
way. However, there are lots of potential problems that you might want to
know about - these are stored in the problems
attribute of the
output, which you can easily access with this function.
stop_for_problems()
will throw an error if there are any parsing
problems: this is useful for automated scripts where you want to throw
an error as soon as you encounter a problem.
problems(x) stop_for_problems(x)
x | An data frame (from |
---|
A data frame with one row for each problem and four columns:
Row and column of problem
What readr expected to find
What it actually got
#> Warning: 2 parsing failures. #> row col expected actual #> 1 -- no trailing characters X #> 2 -- an integer blahproblems(x)#> # A tibble: 2 x 4 #> row col expected actual #> <int> <int> <chr> <chr> #> 1 1 NA no trailing characters X #> 2 2 NA an integer blah#> [1] row col expected actual #> <0 rows> (or 0-length row.names)