<div dir="ltr">Hi Shannon, <div><br></div><div>When you attempted to remove individuals from the genind object by working on the @tab slot (the second step you showed above), what you are really doing is asking to only remove them from the data matrix stored in the @tab slot, and not from all of the meta-information so lovingly stored in other slots of the object. </div><div><br></div><div>The solution is to work with the genind object in its entirety, not just the @tab slot. With the object names you are using, I think this should work:</div><div><br></div><div><div style="font-size:12.8px"> <font color="#6aa84f"># create list of individuals (rows) to remove from @tab slot (and all of the other slots!!)</font><br></div><div style="font-size:12.8px"> <font color="#0000ff"> removeInd <- c("Ind5", "Ind10", "Ind60")</font></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> <font color="#6aa84f"> # remove individuals from <i>genind object</i></font></div><div style="font-size:12.8px"><font color="#6aa84f"> # note that in this step there's no longer a comma needed before the closing square bracket</font></div><div style="font-size:12.8px"> <font color="#0000ff">data <- data[!row.names(data@tab) %in% removeInd]</font></div></div><div><br></div><div>Hope that does the trick!</div><div><br></div><div>All the best, </div><div>Caitlin. </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 29, 2015 at 4:40 AM, Shannon O'Leary <span dir="ltr"><<a href="mailto:shannon.j.oleary@gmail.com" target="_blank">shannon.j.oleary@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>During my data analysis I have identified individuals that I want to remove from the genind object - as opposed to removing those individuals from my genepop file and re-reading it back into R as a genind object.</div><div><br></div><div>I created a list of individual names (I formatted the genind object so that the individuals are named according to my sample names) and used it to subset the matrix stored in the @tab slot.</div><div><br></div><div><br></div><div> # create list of individuals (rows) to remove from @tab slot<br></div><div> removeInd <- c("Ind5", "Ind10", "Ind60")</div><div><br></div><div> # remove individuals from @tab slot</div><div> data@tab <- data@tab[!row.names(data@tab) %in% removeInd,]</div><div><br></div><div><br></div><div>When I check the dimensions of the @tab slot and the number of individuals in the genind object, the returned number indicate that the individuals in the list have been removed from the genind object.</div><div><br></div><div> # number of rows and columns in @tab slot</div><div> dim(GTF_genotypes@tab)</div><div><br></div><div> # number of Individuals in genind object</div><div> nInd(GTF_genotypes)</div><div><br></div><div>But when I check the length of the vector stored in the @pop slot it hasn't changed, same for the information @strata slot.</div><div><br></div><div> # number of individuals in @pop slot</div><div> length(GTF_genotypes@pop)</div><div><br></div><div>Is there a way to remove individuals from the genind object so that that change is then reflected in all the slots of the genind object?</div><div><br></div><div><br></div><div><br></div><div>Thanks,</div><div>Shannon</div><div><br></div><div><br></div>------------------------------------------------------------------------<br><div><div dir="ltr"><div><span style="font-size:12.8px">Shannon J. O'Leary</span><br></div><div>Postdoctoral Research Associate</div><div>Marine Genomics Lab</div><div>Harte Research Institute for Gulf of Mexico Studies</div><div>Texas A&M Corpus Christi</div></div></div>
</div>
<br>_______________________________________________<br>
adegenet-forum mailing list<br>
<a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.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-project.org/cgi-bin/mailman/listinfo/adegenet-forum</a><br></blockquote></div><br></div>