<div dir="ltr">Hi Zhian,<div><br></div><div>What is the second line of code supposed to do? It seems to fail:</div><div><br></div><div><div>> myloc <- locNames(mygenpop)[mygenpop@loc.nall == 2]</div><div>> mygenpop[loc=myloc]<br></div><div>Error in tab[i, j, ..., drop = FALSE] : </div><div> (subscript) logical subscript too long</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 19, 2015 at 12:53 PM, Zhian Kamvar <span dir="ltr"><<a href="mailto:zkamvar@gmail.com" target="_blank">zkamvar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi.<br>
<br>
The function subset is a wrapper for the square brackets that acts on the rows of a data frame or matrix.<br>
<br>
Since you want the loci (columns), you will need to use the loc argument:<br>
<br>
in adegenet 2.0:<br>
<br>
myloc <- locNames(mygenpop)[mygenpop@loc.nall == 2]<br>
mygenpop[loc = myloc]<br>
<br>
in adegenet 1.4:<br>
<br>
myloc <- names(locNames(mygenpop)[mygenpop@loc.nall == 2])<br>
mygenpop[loc = myloc]<br>
<span class="HOEnZb"><font color="#888888"><br>
Zhian<br>
</font></span><div class="HOEnZb"><div class="h5">> On Apr 19, 2015, at 03:00 , <a href="mailto:adegenet-forum-request@lists.r-forge.r-project.org">adegenet-forum-request@lists.r-forge.r-project.org</a> wrote:<br>
><br>
> I was hoping to subset the genpop object conditional upon number of<br>
> alleles, but it doesn't seem to work. Are there any workarounds?<br>
><br>
>> mygenpop_sub <- subset(mygenpop, mygenpop@loc.nall == 2)<br>
> Error in tab[i, j, ..., drop = FALSE] :<br>
> (subscript) logical subscript too long<br>
><br>
> Thanks<br>
> V<br>
<br>
</div></div></blockquote></div><br></div>