Re: [R] Adding zeros in each dimension of an array

2017-06-07 Thread li li
Thanks! That is the method I am using now but I was checking whether there is a simpler option. I will look into the abind package too. Hanna 2017-06-07 12:25 GMT-04:00 Jeff Newmiller : > Please read > https://www.lifewire.com/how-to-send-a-message-in-plain-text > -from-gmail-1171963 > > Re yo

Re: [R] Adding zeros in each dimension of an array

2017-06-07 Thread Jeff Newmiller
Please read https://www.lifewire.com/how-to-send-a-message-in-plain-text-from-gmail-1171963 Re your question: easy is in the eye of the beholder. a <- array( 1:12, dim = c( 2, 2, 3 ) ) b <- array( 0, dim = dim( a ) + 1 ) b[ 1:2, 1:2, 1:3 ] <- a If you want to do a lot of this, it could be wrapp

Re: [R] Adding zeros in each dimension of an array

2017-06-07 Thread David Winsemius
> On Jun 7, 2017, at 8:33 AM, li li wrote: > > For a data frame, we can add an additional row or column easily. For > example, we can add an additional row of zero and an additional row of > column as follows. > > Is there an easy and similar way to add zeros in each dimension? For > example, f

[R] Adding zeros in each dimension of an array

2017-06-07 Thread li li
For a data frame, we can add an additional row or column easily. For example, we can add an additional row of zero and an additional row of column as follows. Is there an easy and similar way to add zeros in each dimension? For example, for array(1:12, dim=c(2,2,3))? Thanks for your help!! Han