rm167
rm167

Reputation: 1247

R combining multiple Matrix in to one

I have a set of matrix named gof_i_j where i= 1 -5 and j= 1-25 (i.e.from gof_1_1 to gof_5_25). So in total i have 125 matrix each with 1 column and 20 rows. I want to combine all the matrix in to one along the column. I know I can use cbind(). But I don't want to type all the names. Any simpler way to do it?

Upvotes: 1

Views: 103

Answers (1)

agstudy
agstudy

Reputation: 121568

Try this for example:

do.call(cbind,mget(ls(pattern ="gof_[1-5]_[0-9]+"))

Upvotes: 2

Related Questions