Hi Ivan,

Thanks for the reply. Damn IT! My original post was screwed up. HERE is what
I did:

x <- read.table("data",header=TRUE,colClasses=rep('raw',600000))
#returns error:  no method or default for coercing "character" to "raw"

 I've read the ?read.table and the colClasses argument. I'm still unclear:

1) colClasses is a character vector, is that right? That seems to be what
the help says, but I get an error when I do the above.

2) what is the most efficient way to read in huge amounts of data? In the
past I found that scan() and readLines() were slower than read.table.

Thanks,

JJ




On Thu, Feb 11, 2010 at 8:53 AM, Ivan Calandra <ivan.calan...@uni-hamburg.de
> wrote:

> Hi!
>
> |"colClasses|       character. A vector of classes to be assumed for the
> columns."
> I'm not an R expert and I don't know what your "flat file raw" is, but
> the colClasses argument is to define whether the column will be treated
> as containing "factors", "logical", "integer" etc...
> For more on read.table, read the manual "R Data Import/Export" available
> on the R-project website.
>
> I don't know if it helps, but I hope it does!
>
> Ivan
>
> Le 2/11/2010 16:36, Johan Jackson a écrit :
> > Hi all,
> >
> > First off, it is surprising that there are no examples of how to use
> > read.table() under ?read.table !
> >
> > I am trying to read in a flat file of type 'raw'. It has 1000 rows and
> 600K
> > columns. I have the RAM to accomplish this, but can't get the data into R
> > using read.table:
> >
> > x<- read.table("data",header=TRUE,colClasses=rep(,600000))
> > #returns error:  no method or default for coercing "character" to "raw"
> >
> > Then I thought that maybe the colClasses vector needed to actually *be*
> the
> > mode needed (here's where an example under ?read.table would help):
> >
> > x<- read.table("data",header=TRUE,colClasses=rep(as.raw(1),600000))
> >
> > I waited on the latter command for a couple of hours before killing the
> > process. What should the colClasses argument be?
> >
> > Should I be using another method to read the data into R? Previous
> > experience using scan() and readLines() showed that read.table() was
> faster,
> > at least for those examples, so I've stopped trying to use those other
> > functions.
> >
> > Thank you,
> >
> > JJ
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@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.
> >
> >
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@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.
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to