[R] problem with read.table
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Fri Feb 25 08:38:40 CET 2000
On Fri, 25 Feb 2000, Kong, Chuang Fong wrote:
> > I recently downloaded R on window and running Rgui on NT. I have never use
> > R before and trying to learn R by following An introduction to R.
> > I generated a table of 900x5 in excel and saved as tab delimited txt file.
> > I then do read.table but I keeping getting the following message
> > > data <- read.table("ML4mm25.txt", header=T, sep=" ")
If it is tab-delimited, you want sep = "\t" there, in both R and S-PLUS.
> > Error in count.fields(file, sep, quote, skip) :
> > can't open file ML4mm25.txt
> > and when I try to count.fields, again there is error message. I was able
> > to use the same command to read the file into S-plus with no problem, can
> > you tell me what is wrong? also, what is the value for quote?
See the help page for read.table. The idea is to that "A label with spaces"
will get read as one field, not four.
I hope that helps. If you need further help, we would need to see the file,
as there are too many possibilities to guess from. (One is that
Excel tends to leave off trailing fields if they are missing.)
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
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