: r-help@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
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
>From the way you describe it, I'd wager that you could probably use the
sample function. For Example:
> group = c("a","b","c","d","e","f","g","h","i","j")
> sample(group,length(group),replace=FALSE)
[1] "h" "j" "g" "f" "d" "i" "e" "b" "a" "c"
but if you change replace to be TRUE
> sample(gro
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, an
4 matches
Mail list logo