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 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
I believe you mean c(sample(1:3,3), sample(1:3, 2, replace = TRUE) is that right? However, we cannot see the combination like 33312. This is a problem. -Original Message- From: Erik Iverson [mailto:er...@ccbr.umn.edu] Sent: Wednesday, August 18, 2010 7:56 PM To: Chen,Shaofei Cc: r-help

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,

[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