Reputation: 603
I am currently looking into some text mining and attempting to read in a flat file with raw texts, however when I read the file in, I am missing more than half the rows after read. The file looks similar to this;
ddjkfj; this is a raw line of text ? fjpflij
jfioej33 this is another line of text jdkfjd
etc.
I am trying to read in, using this method,
data <- read.table('text.txt',sep='\n',fill=T)
How can I read this in without it skipping or joining lines?
Upvotes: 0
Views: 398
Reputation: 10483
You can try using readLines instead:
lines <- readLines('fileToRead.txt')
lines
[1] "ddjkfj; this is a raw line of text ? fjpflij "
[2] "jfioej33 this is another line of text jdkfjd"
Upvotes: 5