fread fails to properly read a well-formed CSV:
library(data.table)
# data.table 1.10.5 IN DEVELOPMENT built 2017-09-29
# Simulate a data.table with many lines in string
example <- data.table(column1 = 1:3, column2 = c("text", "text\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nmany new lines\n\n\n\n\n\n", "text"))
# Write it to a CSV
fwrite(example, file = "example.csv")
# Read it back
fread("example.csv")
# Warning message:
# In fread("example.csv") :
# Found the last consistent line but text exists afterwards (discarded): <<many new lines>>
# base::read.csv behaves well
read.csv("example.csv")
Warning is thrown by this line in fread.c. Interestingly, reducing the number of \n by one remedies the issue.
The problem persists in dev-1.10.5 (built 2017-09-29) across architectures but is not present in release-1.10.4.
freadfails to properly read a well-formed CSV:Warning is thrown by this line in
fread.c. Interestingly, reducing the number of\nby one remedies the issue.The problem persists in dev-1.10.5 (built 2017-09-29) across architectures but is not present in release-1.10.4.