Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

importing text files in R

Tags:

r

eof

I exported results from the SEER database as a .txt file and I have been trying to import it into R for further recoding. The text file was created on Windows OS, and I am working on R on Mac OS X. I changed my working directory before trying to import, but it didn't work. I saw a thread here, which talked about this syntax for exporting .txt files:

students <- read.table(file.choose(), header=T, sep="\t")

I tried this too, but I got the same error message as before:

Warning messages:
1: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
EOF within quoted string
2: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
number of items read is not a multiple of the number of columns

How do I get around this?

like image 337
DDD Avatar asked Jan 20 '26 11:01

DDD


1 Answers

Try read.delim(...) instead of read.table(...)

like image 136
Ekaba Bisong Avatar answered Jan 22 '26 03:01

Ekaba Bisong