R: Sample a vector with replacement multiple times

r

Solution

This is a very convenient way to do this:

replicate(10,sample(x,length(x),replace = TRUE))

Problem

I'd like to sample a vector x of length 7 with replacement and sample that vector 10 separate times. I've tried the something like the following but can't get the resulting 7x10 output I'm looking for. This produces a 1x7 vector but I can't figure out to get the other 9 vectors ``` x <- runif(7, 0, 1) for(i in 1:10){ samp <- sample(x, size = length(x), replace = T) } ```

Original source