Skip to content
Back to formatted view

Raw Message

Message-ID: <3F0072D9.11852.1C96E8@localhost>
Date: 2003-06-30T21:26:49Z
From: Kjetil Halvorsen
Subject: sample from a list of names for random groups
In-Reply-To: <200306301711.13400.daniele.medri@libero.it>

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



> Dear R-users,
> 
> I need to sample from a list of names (people) and create 2 random groups with 
> unique item. Sure sample() function is a good point to start but I can't find 
> example to solve my work.
> 
> any tips? example?
> 
> Thank
> -- 
> Daniele Medri
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help