Re: [R] sample() question

2010-08-18 Thread Chen,Shaofei
Yes it is! I just came up with a method, which needs 5 lines. Thank you very much! -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: Wednesday, August 18, 2010 8:10 PM To: Chen,Shaofei Cc: R Newbie; r-help@r-project.org Subject: Re: [R] sample() question I think

Re: [R] sample() question

2010-08-18 Thread jim holtman
ements in the set > have equal probability to be picked, but I want everyone has to be sampled > at least once. > Thanks! > > -Original Message- > From: R Newbie [mailto:help0938...@gmail.com] > Sent: Wednesday, August 18, 2010 7:12 PM > To: Chen,Shaofei >

Re: [R] sample() question

2010-08-18 Thread Chen,Shaofei
] Sent: Wednesday, August 18, 2010 7:12 PM To: Chen,Shaofei Cc: r-help@r-project.org Subject: Re: [R] sample() question Just to clarify some of your language here before some others rip you apart, you mean to say you'd like to take a random sample of size 5 and not 5 random samples. Now, I believ

Re: [R] sample() question

2010-08-18 Thread Chen,Shaofei
@r-project.org Subject: Re: [R] sample() question On 08/18/2010 07:51 PM, Chen,Shaofei wrote: > Consider an example: > There are 3 stores (1,2,3), and 5 customers. Each store must have at least > one customer. Thus a possible combination is 11213. On the other hand, a > combination

Re: [R] sample() question

2010-08-18 Thread Erik Iverson
! -Original Message- From: Erik Iverson [mailto:er...@ccbr.umn.edu] Sent: Wednesday, August 18, 2010 7:11 PM To: Chen,Shaofei Cc: r-help@r-project.org Subject: Re: [R] sample() question On 08/18/2010 06:58 PM, Chen,Shaofei wrote: Hello all, I have a question regarding sample() in R. For

Re: [R] sample() question

2010-08-18 Thread Chen,Shaofei
,Shaofei Cc: r-help@r-project.org Subject: Re: [R] sample() question On 08/18/2010 06:58 PM, Chen,Shaofei wrote: > Hello all, > > > > I have a question regarding sample() in R. For example, I have a set: > > set<- c(2,3,5) > > and I want to draw 5 samples from this set,

Re: [R] sample() question

2010-08-18 Thread R Newbie
Just to clarify some of your language here before some others rip you apart, you mean to say you'd like to take a random sample of size 5 and not 5 random samples. Now, I believe you can control the probability with which each element of your original data set is sampled (using weights), but in

Re: [R] sample() question

2010-08-18 Thread Erik Iverson
On 08/18/2010 06:58 PM, Chen,Shaofei wrote: Hello all, I have a question regarding sample() in R. For example, I have a set: set<- c(2,3,5) and I want to draw 5 samples from this set, so replacement is true: m<- sample(set, 5, replace=TRUE) However here comes a problem, for example, I will

[R] sample() question

2010-08-18 Thread Chen,Shaofei
Hello all, I have a question regarding sample() in R. For example, I have a set: set <- c(2,3,5) and I want to draw 5 samples from this set, so replacement is true: m <- sample(set, 5, replace=TRUE) However here comes a problem, for example, I will have (2,3,3,2,5), but I will also get (3