[R] excluding factors from sampling

Mike Marchywka marchywka at hotmail.com
Tue Nov 30 22:24:35 CET 2010



I think before for a sensitivty analysis I suggested
just using runiform and an aribtrary cutoff.
You could keep logically "or"-ing your prior hits 

Run runiform of the needed length, do vector boolean ops from
exclusion criteria to get ones you want, get a logical vector or true/false,
select from your array using this, and update whatever exclusion
criteria you have. 

http://www.r-help.com/list/85/746849.html







----------------------------------------
> Date: Tue, 30 Nov 2010 16:04:19 -0500
> From: jholtman at gmail.com
> To: emma.r.moran at gmail.com
> CC: r-help at r-project.org
> Subject: Re: [R] excluding factors from sampling
>
> You could just sample the complete group and then draw off the top the
> number you want; the next time you go to the well, they are missing
> and you get something from the remainder. You can also do 'setdiff'
> to get the difference.
>
> On Tue, Nov 30, 2010 at 12:45 PM, Emma Moran  wrote:
> > Hello,
> >
> > I am trying to write a function that first requires randomly sampling items
> > from a set of factors. I need to be able to sample from that same set of
> > factors, but exclude the ones that have already been sampled previously. For
> > example, suppose I have a set of items a-j (a,b,c,d,e,f,g,h,i, and j) and
> > randomly sample a, c, and f from that group. How do I sample again from the
> > larger group (a-j) but exclude the items (a,c,f) that I have already
> > sampled. I want this to be a function, so I don't want to just manually
> > exclude a,c, and f.
> >
> > Thanks!
> >
> > --
> > Emma Moran
> > Washington University in St Louis
> > Biology Department
> > McDonnell Hall Rm 419
> > One Brookings Drive, St. Louis, MO 63130
> > emoran at wustl.edu
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
 		 	   		  


More information about the R-help mailing list