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

Tolerate blank lines ... at least at the end of input? #321

Closed
jennybc opened this Issue Nov 25, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@jennybc
Member

jennybc commented Nov 25, 2015

library(readr)
input <- "x,y\n1,2\n\n"
read.csv(text = input)
#>   x y
#> 1 1 2
read_csv(input)
#> Warning: 1 parsing failure.
#> row col  expected    actual
#>   2  -- 2 columns 1 columns
#> Source: local data frame [2 x 2]
#> 
#>       x     y
#>   (int) (int)
#> 1     1     2
#> 2    NA    NA
read_csv(trimws(input))
#> Source: local data frame [1 x 2]
#> 
#>       x     y
#>   (int) (int)
#> 1     1     2

It seems reasonable to tolerate and ignore blank lines ... at least at the end of the input.

@hadley

This comment has been minimized.

Member

hadley commented Jun 2, 2016

Yeah, I think that's totally reasonable (and for empty lines anywhere, not just at the end). It's just a little tricky to implement because you need to think more about what line numbers to report in error messages etc - the original line numbers, or the row numbers in the generated data frame.

@hadley hadley modified the milestone: 0.3.0 Jul 13, 2016

@hadley hadley closed this in 9f19264 Jul 13, 2016

@hadley hadley removed the ready label Jul 13, 2016

@lock lock bot locked and limited conversation to collaborators Sep 25, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.