[R] multi-dimension array of raw

From: Gerald Jansen <gerald.jansen_at_newpage.ca>
Date: Wed 21 Jun 2006 - 08:24:09 EST


I would like to store and manipulate large sets of marker genotypes compactly using "raw" data arrays. This works fine for vectors or matrices, but I run into the error shown in the example below as soon as I try to use 3 dimensional arrays (eg. animal x marker x allele).

> a <- array(as.raw(1:6),c(2,3))
> a

     [,1] [,2] [,3]
[1,] 01 03 05
[2,] 02 04 06
> a[1,] <- raw(3)
> a

     [,1] [,2] [,3]
[1,] 00 00 00
[2,] 02 04 06
> b <- array(as.raw(1:6),c(1,2,3))
> b[1,,]

     [,1] [,2] [,3]
[1,] 01 03 05
[2,] 02 04 06
> b[1,1,] <- raw(3)
Error: incompatible types (from raw to raw) in array subset assignment

I can work around this with computed indices, but I wonder if this is expected behaviour.

Gerald Jansen



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 Received on Wed Jun 21 08:28:28 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 Wed 21 Jun 2006 - 20:11:13 EST.

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