Re: [R] reading only some columns from a table

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon 30 Oct 2006 - 10:48:26 GMT

Sorry, here it is fixed up. The c should have been list:

Lines <- "conid person construct
1 1 offence
2 1 insight"

read.table(textConnection(Lines), header = TRUE,   colClasses = list(person = NULL))

On 10/30/06, Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
> Here is an example:
>
> > Lines <- "conid person construct
> + 1 1 offence
> + 2 1 insight"
> >
> > read.table(textConnection(Lines), header = TRUE,
> + colClasses = c(person = NULL))
> conid person construct
> 1 1 1 offence
> 2 2 1 insight
>
>
>
>
> On 10/30/06, Amir Safari <amsa36060@yahoo.com> wrote:
> >
> > Thank you so much for reply. I tried to do your suggested idea. It did not
> > work. what could be my mistake ? I got the same result with and without
> > colClasses=c() arguement. What could be the reason? even using header=TRUE
> > the result change slightly but not into desired one.
> >
> >
> >
> > Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
> > See the colClasses argument of read.table.
> >
> > e.g.
> >
> > read.table("myfile", header = TRUE, colClasses = c(person = NULL))
> >
> > assuming you don't want the column labelled person in the header.
> >
> > On 10/30/06, Amir Safari wrote:
> > >
> > >
> > > Dear R users,
> > > Sometimes it is needed to read only some columns from a table, in
> > particulare for high frequency data. How it is possible to read just some
> > certain columns using read.table ( ). The reason could be keeping space in R
> > and in particular accelerating in reading data when the number of rows are
> > huge and some of them are not needed.
> > > Thank you very much,
> > > Amir
> > >
> > >
> > > ---------------------------------
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-help@stat.math.ethz.ch 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.
> > >
> >
> >
> >
> > ________________________________
> > Everyone is raving about the all-new Yahoo! Mail.
> >
> >
>



R-help@stat.math.ethz.ch 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 Tue Oct 31 02:17:06 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 30 Oct 2006 - 15:30:14 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.