<div dir="ltr">Hi Mark, <div><br></div><div>I wonder if there isn't a function doing just that in poppr, but here's a simple way to do it using microbov:</div><div><br></div><div>## subset 10 pop (I can't use 20 here)</div><div>x <- microbov[pop = sample(seq_len(nPop(microbov)), 10)]</div><div><br></div><div>## sample individuals with replacement - here, 5 per pop</div><div>sampled_indiv <-
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">unlist(tapply(seq_len(nInd(x)), pop(x), sample, size = 5, replace = TRUE))</span>
</div><div>new_data <- x[<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">sampled_indiv</span>]<br></div><div><br></div><div>Cheers</div><div>Thibaut</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br>--<br>Dr Thibaut Jombart<br>Lecturer, Department of Infectious Disease Epidemiology, Imperial College London<br>Head of RECON: <a href="http://repidemicsconsortium.org" target="_blank">repidemicsconsortium.org</a><br>WHO Consultant - outbreak analysis</div><div><a href="https://thibautjombart.netlify.com" target="_blank">https://thibautjombart.netlify.com</a><br>Twitter: @TeebzR<br>+44(0)20 7594 3658</div></div></div></div>
<br><div class="gmail_quote">On 12 April 2018 at 15:17, Mark Coulson <span dir="ltr"><<a href="mailto:Mark.Coulson.ic@uhi.ac.uk" target="_blank">Mark.Coulson.ic@uhi.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="m_6902965396632991803WordSection1">
<p class="MsoNormal">I have a genind object with ~40 populations of varying sample sizes. I want to take 20 of these groups and sample 10 individuals at random (without replacement) from each of these 20 populations into a new group (which will end up being
200 individuals). I can’t quite figure out how to best do this. Does it require seppop? If so then how do I avoid specifying a draw of twenty individual for each individually separate population?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks<u></u><u></u></p>
<p class="MsoNormal">Mark<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
Inverness College UHI, a partner in the University of the Highlands and Islands <a href="http://www.inverness.uhi.ac.uk" target="_blank">www.inverness.uhi.ac.uk</a> Board of Management of Inverness College (known as Inverness College UHI), Scottish Charity No SC021197.
</div>
<br>______________________________<wbr>_________________<br>
adegenet-forum mailing list<br>
<a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.<wbr>r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" rel="noreferrer" target="_blank">https://lists.r-forge.r-<wbr>project.org/cgi-bin/mailman/<wbr>listinfo/adegenet-forum</a><br></blockquote></div><br></div>