Skip to content
Prev 315409 / 398503 Next

matrix manipulation with its rows

Hi

with  your specific example you can use

remat<-function(mat) {
mt<-t(mat)
mt<-c(mt[1:3], rep(0,6), mt[4:6])
matrix(mt, 2,6, byrow=TRUE)
}

lapply(sample, remat)

Regards
Petr