I am trying to read a table using fread. There is text in the txt file that looks like this:
"No","Comment","Type"
"0","he said:"wonderful|"","A"
"1","Pr/ "d/s". "a", n) ","B"
R-codes that I use: dataset0 <- fread("data/test.txt", stringsAsFactors = F)with the version for the development of the data package .table R.
Expect to see a dataset with three columns; However:
Error in fread(input = "data/stackoverflow.txt", stringsAsFactors = FALSE) :
Line 3 starting <<"1","Pr/ ">> has more than the expected 3 fields.
Separator 3 occurs at position 26 which is character 6 of the last field: << n) ","B">>.
Consider setting 'comment.char=' if there is a trailing comment to be ignored.
How to solve it?
A.Yin source
share