(resent as hotmail really cannot format plaintext, but I've just read
Tony Plate's message that what I'd like to do might not be possible)
>
> library(abind)  ## array binding

I've looked into using abind() but it seems I might not understand it properly.

I can build my 2 table array and insert a row into each table using:

        x <- array(0,c(1,3,2))

        x[,,1] <- c(1,2,3)

        x[,,2] <- c(7,8,8)


And I can use rbind() or abind() to add a row to the first table and
assign it to a separate object.

        y <- rbind(x[,,1], c(4,5,6))
or
        z <- abind(x[,,1], c(4,5,6),along=0)


But I can't determine how to add a row in place to a single table of
the 3-dimensional array. For example, this does not work:

        x[,,1] <- abind(x[,,1], c(4,5,6),along=0)
            Error in x[, , 1] <- abind(x[, , 1], c(4, 5, 6), along = 0) :
              number of items to replace is not a multiple of replacement length

Using the above code, I would somehow like 'x' to be:

> x
, , 1

     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    4    5    6

, , 2

     [,1] [,2] [,3]
[1,]    7    8    9


Thanks for any help.

        [[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