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.
It seems reasonable to tolerate and ignore blank lines ... at least at the end of the input.