I am trying to import a large .txt file that uses |,| to separate columns. The raw data looks like this:
The original .txt file has 593 118 lines (entries). However, using my import line I can only import 191 838 lines, and a lot of these lines are imported incorrectly. The imported file looks like this (e.g., lines 189880:189889 are imported correctly, the others are not):
The number of columns is correct using this code, it only fails to import all rows correctly. In addition, when using my import code, the following warning message pops up:
Test<-read.csv("test2.txt", header = FALSE, sep = ",", quote = "|")
Warning message:
In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
EOF within quoted string
I can import 544 605 lines using the following import command (switching the quote:"|" and sep=","):
Test<-read.csv("test2.txt", header = FALSE, sep = “|", quote = “,”)
Only now, the whole file looks messy, and the data are in the wrong columns and a wrong number of columns are created (41 instead of 39):
Does someone know how to import this .txt file correctly?