Re: [R] how do I read only specific columns using read.csv or other read function

From: Ben Tupper <PemaquidRiver_at_tidewater.net>
Date: Wed, 02 Jul 2008 07:09:53 -0400

On Jul 2, 2008, at 6:53 AM, Philip James Smith wrote:

> Hi R people:
>
> I have huge files with as many as 5000 columns. I'd really like to
> read only certain columns of those files. I know column names I
> want to read.
>
> I looked at the documentation of read.csv . Although there is a
> col.names option, it allows users to specify the names of the
> columns, rather than to pick the columns of interest.
>
> Any suggestions on how to pick the columns I want to read only,
> rather than the entire file, would be greatly appreciated.
>

Hello,

I think you want explicitly set the colClasses argument such that the columns you *don't* want are set to NULL and all others are set to appropriate classes.

Cheers,
Ben

> Phil Smith
> Duluth, GA
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

Ben Tupper
PemaquidRiver_at_tidewater.net

I GoodSearch for Ashwood Waldorf School.

Raise money for your favorite charity or school just by searching the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo!



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 02 Jul 2008 - 11:12:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jul 2008 - 18:31:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive