[R] Selective column loads with scan()
Uwe Ligges
ligges at statistik.uni-dortmund.de
Sun Jan 7 19:54:21 CET 2001
On Sun, 7 Jan 2001, Samir Mishra wrote:
> Help!
>
> I have a very large data file with about 100 columns. Instead of loading
> all of the columns using read.table() (my PC won't be able to handle the
> resulting data frame), I'd like to read in one column of the datafile at
> a time using scan() in conjunction with the 'what = ' option. I've tried
> loading just the third column using -
>
> > scan(file.name, what = list(NULL, NULL, "", rep(NULL, 97)). ... )
>
> along with a couple of other options but I can't get the results I want
> (if I avoid an error). For example -
> > list(NULL, NULL, "", rep(NULL, 97))
> [[1]]
> NULL
>
> [[2]]
> NULL
>
> [[3]]
> [1] ""
>
> [[4]]
> NULL
>
> is not what i'm looking for.
>
> Is there a better way to selectively read in individual columns from a tab
> separated data file?
>
> I've done this before, and that makes this exercise even more frustrating.
Try
scan(file.name, what = list(, , ""), flush = TRUE)
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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