[R] naive question
Patrick Connolly
p.connolly at hortresearch.co.nz
Wed Jun 30 04:53:14 CEST 2004
On Tue, 29-Jun-2004 at 10:31PM -0400, rivin at euclid.math.temple.edu wrote:
|> > We need more details about your problem to provide any useful
|> > help. Are all the variables numeric? Are they all completely
|> > different? Is it possible to use `colClasses'?
|> >
|> It is possible, but very inconvenient. There are mostly numeric columns,
|> but some integer categories, and some string names. The total number is
|> high, so doing this by hand would take several minutes as well, so a
|> different solution is preferable. I did use as.is=TRUE, but that did not
For the lazy typist, here's an idea:
Make a small subset of the datafile (say the first 20 rows) and read
that in with read.table.
X <- read.table("blah.txt", header = TRUE, ........)
Xclasses <- sapply(X, class)
Now we have a nice long vector that you can use in your colClasses
argument with the whole data. Even if it needs a bit of editing, it
will save you typing in all those "numeric" strings.
HTH
--
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand
Ph: +64-9 815 4200 x 7188
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
More information about the R-help
mailing list