[R] How to more efficently read in a big matrix

Gabor Grothendieck ggrothendieck at gmail.com
Sat Nov 10 06:28:51 CET 2007


On Nov 10, 2007 12:19 AM, affy snp <affysnp at gmail.com> wrote:
> Thanks Jim.
>
> I tried:
>
> A<-read.table(file="243_47mel_withnormal_expression_log2.txt",
> +header=TRUE,row.names=1,colClasses=c('factor', rep('numeric',486)))
>
> by specifying colClass but it did not work.
>
> The error message I got is:
>
> > A<-read.table(file="243_47mel_withnormal_expression_log2.txt",header=TRUE,row.names=1,colClasses=c('factor', rep('numeric',486)))
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
>  scan() expected 'a real', got 'B'
>

That's because you have only specified 487 variables to colClasses but
there are
actually 488 variables since the row names count.  See the colClasses entry of
?read.table where it is explained.



More information about the R-help mailing list