[R] exclude a vector value from another vector

2008-12-01 Thread Hamid Hamid
Dear All, I am trying to build a program which will take repeated samples (w/o replacement) from a population of values. The interesting catch is that I would like the sample values to be removed from the population, after each sample is taken. For example: pop<-c(1,5,14,7,9,12,18,19,65,54) sa

Re: [R] exclude a vector value from another vector

2008-12-01 Thread Jorge Ivan Velez
Dear Hamid, Try this: > pop<-c(1,5,14,7,9,12,18,19,65,54) > pop [1] 1 5 14 7 9 12 18 19 65 54 > spop<-sample(pop,2) > spop [1] 14 19 > newpop=pop[!pop%in%spop] > newpop [1] 1 5 7 9 12 18 65 54 See ?"%in%"" for more information. HTH, Jorge On Mon, Dec 1, 2008 at 2:16 PM, Hamid Hamid

Re: [R] exclude a vector value from another vector

2008-12-02 Thread Greg Snow
uot; "Z" "I" > Now each column is a sample, us apply or a for loop to work on each one. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL

Re: [R] exclude a vector value from another vector

2008-12-02 Thread Henrique Dallazuanna
Try this: setdiff(pop, sample(pop, 2)) On Mon, Dec 1, 2008 at 5:16 PM, Hamid Hamid <[EMAIL PROTECTED]> wrote: > Dear All, > I am trying to build a program which will take repeated samples (w/o > replacement) from a population of values. The interesting catch is that I > would like the sample va