[adegenet-forum] Removing individuals from genind obj

Shannon O'Leary shannon.j.oleary at gmail.com
Thu Oct 29 05:40:02 CET 2015


Hi,

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.

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.


     # create list of individuals (rows) to remove from @tab slot
     removeInd <- c("Ind5", "Ind10", "Ind60")

     # remove individuals from @tab slot
     data at tab <- data at tab[!row.names(data at tab) %in% removeInd,]


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.

     # number of rows and columns in @tab slot
     dim(GTF_genotypes at tab)

     # number of Individuals in genind object
     nInd(GTF_genotypes)

But when I check the length of the vector stored in the @pop slot it hasn't
changed, same for the information @strata slot.

     # number of individuals in @pop slot
     length(GTF_genotypes at pop)

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?



Thanks,
Shannon


------------------------------------------------------------------------
Shannon J. O'Leary
Postdoctoral Research Associate
Marine Genomics Lab
Harte Research Institute for Gulf of Mexico Studies
Texas A&M Corpus Christi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20151028/03cb01f1/attachment.html>


More information about the adegenet-forum mailing list