[R] reading raw matrix saved with writeBin

Henrik Bengtsson hb at stat.berkeley.edu
Thu Mar 15 11:32:33 CET 2007


FYI, to save data as bitmap images, see the EBImage package on Bioconductor.

/H

On 3/15/07, Ranjan Maitra <maitra at iastate.edu> wrote:
> On Wed, 14 Mar 2007 18:45:53 -0700 (PDT) Milton Cezar Ribeiro <milton_ruser at yahoo.com.br> wrote:
>
> > Dear Friends,
> >
> > I saved a matrix - which contans values 0 and 1 - using following command:
> > writeBin (as.integer(mymatrix), "myfile.raw",  size=1).
> >
> > It is working fine and I can see the matrix using photoshop. But now I need
> > read the matrices again (in fact I have a thousand of them) as matrix into R but when
> > I try something like  mat.dat<-readBin ("myfile.raw",size=1) I can´t access the
> > matrix
> >
> > Kind regards,
> >
> > Miltinho
> >
> > __________________________________________________
> >
> >
> >       [[alternative HTML version deleted]]
> >
>
> Look up the help file. There is an explicit example. Basically, you need to tell the file to read in binary.
>
> In fact, I am a little surprised your first command works while writing.
>
> HTH!
> Ranjan
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list