Home:ALL Converter>Repeat matrix n-times into a list

Repeat matrix n-times into a list

Ask Time:2014-02-03T13:47:53         Author:spesseh

Json Formatter

I have a matrix that i want to duplicate n times in a list. Obviously the rep() function does not work on matrices, so does anyone have a good suggestion how to make this better than my code below?

Thanks!

# Create sample matrix
jwprox <- matrix(ncol=15,nrow=15)
# Create list of n-times matrices
jwprox <- list(jwprox,jwprox,jwprox)

Author:spesseh,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/21520552/repeat-matrix-n-times-into-a-list
yy