Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect problem rows displayed by problems() when printing before calling #535

Open
khusmann opened this issue Apr 14, 2024 · 0 comments

Comments

@khusmann
Copy link

(Running vroom 1.6.5 & readr 2.1.5 on Ubuntu)

When I call problems() after printing in this example, I get 2 problems flagged, instead of 1. The first doesn't look right ("z" is not on row 2):

library(vroom)

foo <- vroom(
  I("a\n1\n2\nz\n"),
  delim = ",",
  col_types=cols(a = col_double())
)

print(foo)
#> Warning: One or more parsing issues, call `problems()` on your data frame for details,
#> e.g.:
#>   dat <- vroom(...)
#>   problems(dat)
#> # A tibble: 3 × 1
#>       a
#>   <dbl>
#> 1     1
#> 2     2
#> 3    NA

problems(foo)
#> # A tibble: 2 × 5
#>     row   col expected actual file                              
#>   <int> <int> <chr>    <chr>  <chr>                             
#> 1     2     1 a double z      /tmp/RtmpUAw9hE/file1d28ab72074760
#> 2     4     1 a double z      /tmp/RtmpUAw9hE/file1d28ab72074760

If I do not call print(), problems() works just fine:

library(vroom)

foo <- vroom(
  I("a\n1\n2\nz\n"),
  delim = ",",
  col_types=cols(a = col_double())
)

problems(foo)
#> Warning: One or more parsing issues, call `problems()` on your data frame for details,
#> e.g.:
#>   dat <- vroom(...)
#>   problems(dat)
#> # A tibble: 1 × 5
#>     row   col expected actual file                              
#>   <int> <int> <chr>    <chr>  <chr>                             
#> 1     4     1 a double z      /tmp/RtmpfGW535/file1d2950234b269b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant