[R] naive question
rivin@euclid.math.temple.edu
rivin at euclid.math.temple.edu
Wed Jun 30 05:04:19 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
>
Aha! That could be the right trick. I will try it and see how it works...
Thanks,
Igor
More information about the R-help
mailing list