Grace G Grace G - 3 years ago 132
R Question

how to make vectorx replicates 1000 times to get a frame use R

Like

vectorx <- c(10:20)
, to get framex, and the
dim()
of it is
1000*10


I know how to get the frame by for loop. But is there one function can realize?

Answer Source

If you want to replicate a vector vectorxfor 1,000 times , try matrix:

matrix(vectorx, nrow = 1000, ncol = length(vectorx), byrow = T)

Note: for you example, the final dim would be 1,000 x 11 as 10:20 has 11 elements.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download