How to select samples in R

Asked

Viewed 84 times

5

How to select 100 size samples n = 10, without replacement, using a population of N = 1000?

My population:

set.seed(1234)
x <- rnorm(1000, mean = 100, sd = 20)

1 answer

6


You can use replicate + sample with replace false:

a <- replicate(100, sample(x = x, size = 10, replace = F))

The replicate will replicate the number of times you stipulate the function within it. In this case it will replicate 100 times the sample function.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.