Open ZTaylor205 opened 6 years ago
It turns out that the madness-specific commands blockrep() and repto() will accomplish these functions, when combined with aperm(). I'm using them as a workaround at the moment.
Unfortunately, I've discovered a problem with the workaround, along with a corresponding workaround. I will post two additional issues.
I think in your case you just need to use repto
?
x < c(1,2,3,4,5)
xmad <- madness(x)
I <- 5
K <- 3
xarray = array(x,dim = c(I,I,K))
ymad <- repto(xmad,c(I,I,K))
# show that they are the same:
ymad@val - array(x,dim=c(I,I,K))
I am not sure aperm
is needed for this?
Cbind and rbind appear to work, but not more complicated reshaping. In this example, I have a vector 1,2,3,4,5 and I would like to create a 5x5x3 array such that everything in row i has value i.
Edit: I thought I might be able to replicate and then fill a matrix, but it turns out: