chattrat423
chattrat423

Reputation: 603

R raw text file missing lines after read

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

Answers (1)

Gopala
Gopala

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

Related Questions