Hello,
Please read the posting guide: to draw samples from what? A vector?
Matrix? Etc...
Anyway, here it goes. In all cases the result is a list with 4 elements.
# Draw 4 samples of integers from 1 to 10
x <- rep(10, 4)
# without replacement
set.seed(1)
lapply(x, sample, size=6)
# with rep
I would be good if you showed us what you are doing now. There are
ways of drawing samples and storing in a list, but we have to see what
you are trying to accomplish. You could use 'lapply' or do it in a
loop, but the solution would depend on how you are doing things now
and what is the problem
2 matches
Mail list logo