I have 60 matrices in R named as mat1, mat2....mat60 and I would like to combine them into a big matrix using rbind. I know that I could write something like
I think this question really relates to the OP having to type out the names of the matrices manually. You can use mget
to return the matrices in a list and then use do.call
and rbind
as posed by @Michele like this (assuming the matrices are located in the .GlobalEnv
):
matList <- mget(paste0("mat",1:60),env=globalenv())
bigm <- do.call("rbind" , matList)