An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121030/62c822d8/attachment.pl>
Put submatrices in an array
3 messages · Haris Rhrlp, Pascal Oettli, Rolf Turner
Hello, According to your script, the dimension of AA should be 16x3x161051. Best Regards, Pascal Le 30/10/2012 16:30, Haris Rhrlp a ?crit :
Dear R users, I have a Hadamard matrix 16x15 and i want to put 16x5 submatrices in an array put i have an error.
A1<-matrix(c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, + 0,1,1,0,0,1,1,0,0,1,1,0,0,1,1, + 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0, + 0,0,0,1,1,1,1,0,0,0,0,1,1,1,1, + 1,0,1,1,0,1,0,0,1,0,1,1,0,1,0, + 0,1,1,1,1,0,0,0,0,1,1,1,1,0,0, + 1,1,0,1,0,0,1,0,1,1,0,1,0,0,1, + 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, + 1,0,1,0,1,1,0,1,0,1,0,1,0,0,1, + 0,1,1,0,0,1,1,1,1,0,0,1,1,0,0, + 1,1,0,0,1,0,1,1,0,0,1,1,0,1,0, + 0,0,0,1,1,1,1,1,1,1,1,0,0,0,0, + 1,0,1,1,0,0,1,1,0,1,0,0,1,1,0, + 0,1,1,1,1,0,0,1,1,0,0,0,0,1,1, + 1,1,0,1,0,1,0,1,0,0,1,0,1,0,1),ncol=15,byrow=T)
AA<-array(rep(0,240240),dim=c(16,5,3003))
n<-0
for (i in 1:11) {
+ for (j in 2:12) {
+ for (k in 3:13) {
+ for (l in 4:14) {
+ for (m in 5:15) {
+ n<-n+1
+ AA[,,n]<-cbind(A1[,i],A1[,j],A1[,k],A1[,l],A1[,m])
+ }
+ }
+ }
+ }
+ }
Error in AA[, , n] <- cbind(A1[, i], A1[, j], A1[, k], A1[, l], A1[, m]) :
subscript out of bounds
Any help wil be welcome!!
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121030/453a2672/attachment.pl>