[R] Selective column loads with scan()

Samir Mishra sqmishra at excite.com
Sun Jan 7 19:02:19 CET 2001


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] ""


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.

Thanks in advance. 

Samir Mishra
Please send replies to :
sqmishra at acm.org

Send a cool gift with your E-Card

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