Say I have the first test.csv
that looks like this
,a,b,c,d,e
If I try to read it using read.csv
, it works fine.
read.csv("test.csv",header=FALSE)
# V1 V2 V3 V4 V5 V6
#1 NA a b c d e
#Warning message:
#In read.table(file = file, header = header, sep = sep, quote = quote, :
# incomplete final line found by readTableHeader on 'test.csv'
However, if I attempt to read this file using fread
, i get an error instead.
require(data.table)
fread("test.csv",header=FALSE)
#Error in fread("test.csv", header = FALSE) :
# Not positioned correctly after testing format of header row. ch=','
Why does this happen and what can I do to correct this?
read.csv()
. If you'd like to not have that NA column, use theselect
argument as:fread("test.csv", select=2:6, header=FALSE)
. – Ronnironnica