Hi, I would like to add rows to arbitrary tables within a 3dimensional array. I can directly add data to an existing row of a table:> x <- array(0,c(1,3,2))> x[,,1] <- c(1,2,3)And I can even add a row to the table and assign to another object.> y <- rbind(x[,,1], c(4,5,6))and 'y' is what I want it to be:> y?? ? [,1] [,2] [,3][1,] ? ?1 ? ?2 ? 3[2,] ? ?4 ? ?5 ? 6 but I can't do this within the 3dimensional array:> x[,,1] <- rbind(x[,,1], c(4,5,6))Error in x[, , 1] <- rbind(x[, , 1], c(4, 5, 6)) :???number of items to replace is not a multiple of replacement lengthDoes anyone know I can add rows to one of tables within the array? Thanks. _________________________________________________________________ Hotmail: Free, trusted and rich email service.
library(abind) ## array binding
<4ADBCA02.8020101 at temple.edu> Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0>=20 > library(abind) ## array bindingI've looked into using abind()=2C but it seems I might not understand it properly. I can build my 2 table array=2C and insert a row into each table using: =A0=A0=A0=A0=A0=A0=A0 x <- array(0=2Cc(1=2C3=2C2)) =A0=A0=A0=A0=A0=A0=A0 x[=2C=2C1] <- c(1=2C2=2C3) =A0=A0=A0=A0=A0=A0=A0 x[=2C=2C2] <- c(7=2C8=2C9) And I can use rbind() or abind() to add a row to the first table and assign it to a separate object. =A0=A0=A0=A0=A0=A0=A0 y <- rbind(x[=2C=2C1]=2C c(4=2C5=2C6)) =A0=A0=A0=A0=A0=A0=A0 z <- abind(x[=2C=2C1]=2C c(4=2C5=2C6)=2Calong=3D0) But I can't determine how to add a row in place to a single table of the 3 dimensional array. For example=2C this does not work: =A0=A0=A0=A0=A0=A0=A0 x[=2C=2C1] <- abind(x[=2C=2C1]=2C c(4=2C5=2C6)=2Calong=3D0) Error in x[=2C =2C 1] <- abind(x[=2C =2C 1]=2C c(4=2C 5=2C 6)=2C along =3D 0) :=20 =A0 number of items to replace is not a multiple of replacement length I would like 'x' to be:> x=2C =2C 1 =A0=A0=A0=A0 [=2C1] [=2C2] [=2C3] [1=2C]=A0=A0=A0 1=A0=A0=A0 2=A0=A0=A0 3 [2=2C]=A0=A0=A0 4=A0=A0=A0 5=A0=A0=A0 6 =2C =2C 2 =A0=A0=A0=A0 [=2C1] [=2C2] [=2C3] [1=2C]=A0=A0=A0 7=A0=A0=A0 8=A0=A0=A0 9 Thanks for any help. =20 _________________________________________________________________ Hotmail: Trusted email with Microsoft=92s powerful SPAM protection.