[R] How to read a text table? A bit of trouble with Using R - An Introduction

Jonathan Baron baron at cattell.psych.upenn.edu
Tue Feb 27 12:29:39 CET 2001

>    Ok...So I actually *typed* the table with WordPad, using the Tab button
>in order to separate the columns, and saved it in rich text format. As you
>might have guessed, it didn´t work. I got a:
>    Error in count.fields(file, sep, quote, skip, blank.lines.skip) :
>        string terminated by newline or EOF

RTF is not what is meant by text.  What I am writing is text.
Your email is almost text (perhaps even legal).  Look at the RTF
file itself in an editor such as Emacs or (ugh) Notepad.  I don't
know if Wordpad can even make text, although I think it can.

>    I cut and pasted austpop.R text content and saved it as...austpop.txt in
>my working directory.
>    Then, I went for the kill :-)
>    > austpop <- read.table("C:/R/austpop.txt", header=T)
>    but it read:
> [1]  9 11 11 12 12 15 14 15 11 14 15 16
>Error in read.table("C:/R/austpop.txt", header = T) :
>        all rows must have the same length.

The instructions you quoted said to use source() rather than
read.table().  I have not tried it, but that may be worth a try.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list