Im trying to create a vector by combining multiple matrixes using a loop. If I do it manually it looks like this:
vector = c(
matrix(labels[1],ccl$size[1]),
matrix(labels[2],ccl$size[2]),
matrix(labels[3],ccl$size[3]),
matrix(labels[4],ccl$size[4]),
matrix(labels[5],ccl$size[5]))
labels is a vector with a given number of elements, as is ccl$size. the problem is that no loop seems to accept any substring of the function as a valuable input.
edit: I tried
c(for(i in repeats)
{matrix(labels[i],ccl$size[i]),}
)
edit2:
inputs labels: c(2,1,3)
ccl$size: c(12,10,7)
desired output c(2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3,3)
rep?rep(labels, ccl$size)