[R] excluding factors from sampling

jim holtman jholtman at gmail.com
Tue Nov 30 22:04:19 CET 2010


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 <emma.r.moran at gmail.com> 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?



More information about the R-help mailing list