Skip to content

"Unable to find 5 lines with expected number of columns" warning when freading 16 lines #1124

@richierocks

Description

@richierocks

When calling fread on a file with exactly 16 lines, I get the warning "Unable to find 5 lines with expected number of columns (+ last)".

To reproduce:

library(data.table)
n <- 16
d <- data.table(
  x = 1:n,
  y = letters[1:n]
)

lines <- c(
  paste(colnames(d), collapse = ","), 
  paste(d$x, d$y, sep = ",")
)
(lines <- paste(lines, collapse = "\n"))
## [1] "x,y\n1,a\n2,b\n3,c\n4,d\n5,e\n6,f\n7,g\n8,h\n9,i\n10,j\n11,k\n12,l\n13,m\n14,n\n15,o\n16,p"
fread(lines)

If you change n to 15 or 17, the warning does not occur.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions