Skip to content
Back to formatted view

Raw Message

Message-ID: <3F00635C.4040904@pdf.com>
Date: 2003-06-30T16:20:44Z
From: Spencer Graves
Subject: sample from a list of names for random groups

> n1 <- 2
 > n2 <- 3
 > (S <- sample(letters, n1+n2))
[1] "f" "a" "d" "n" "l"
 > (S1 <- sample(S, n1))
[1] "l" "n"
 > (S2 <- S[!is.element(S, S1)])
[1] "f" "a" "d"
 >
hope this helps.  spencer graves

Daniele Medri wrote:
> 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