Skip to content
Prev 34036 / 398513 Next

sample from a list of names for random groups

On 30 Jun 2003 at 17:11, Daniele Medri wrote:
You should really try to specify better what you want. Lets try

names # character vector with your names
m <- length(names)
n1 <- 5
n2 <- 10
muestra <- sample(names, m, replace=FALSE)
muestra1 <- muestra[1:n1]
muestra2 <- muestra[(n1+1):(n1+n2)]

Is this what you want?

Kjetil Halvorsen