Skip to content
Prev 18144 / 398503 Next

repeating rows or columns within a matrix

On Thu, Mar 21, 2002 at 12:19:37PM +0200, Juhana Vartiainen wrote:
I do not know if it is a smart way, but that's a way:

m <- matrix(1:9, 3, 3, byrow=T)
rep.fact <- 2  # repeating factor, say 2
mm <- matrix(rep(m, rep(rep.fact, length(m))), nrow(m)*rep.fact, ncol(m))


Hopin' it helps,



Laurent