[R-sig-Geo] Repeat columns and rows of matrix

az14 abidi.zineb at gmail.com
Fri May 9 13:33:37 CEST 2014


Dear list, 
i have a matrixW(1060*1060), i want to repeat each column and row 9 times,
such as to have a new matrix W1(9540*9540).
I use the code: 
rep.row<-function(x,n){
   matrix(rep(x,each=n),nrow=n)
}
rep.col<-function(x,n){
   matrix(rep(x,each=n), ncol=n, byrow=TRUE)
}

ww<-rep.row(w,9)
W1<-rep.col(ww,9)

but i did not work! 

Is there another way to do it ?

Any help would me appreciated. 
Thank YOU.



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Repeat-columns-and-rows-of-matrix-tp7586408.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list