Accessors {adegenet} | R Documentation |
Several accessors for genind or genpop objects. The operator "$" and "$<-" are used to access the slots, being equivalent to "@" and "@<-".
The operator "[" can be used to access components of the matrix slot
"@tab", returning a genind or genpop
object. This syntax is the same as for a matrix; for instance:
- "obj[,]" returns "obj"
- "obj[1:10,]" returns an object with only the first 10 genotypes (if
"obj" is a genind) or the first 10 populations (if
"obj" is a genpop) of "obj"
- "obj[1:10, 5:10]" returns an object keeping the first 10 entities and
the alleles 5 to 10.
Thibaut Jombart jombart@biomserv.univ-lyon1.fr
data(nancycats) nancycats nancycats$pop # let's isolate populations 4 and 8 temp <- nancycats@pop=="P04" | nancycats@pop=="P08" obj <- nancycats[temp,] obj truenames(obj)$pop # let's isolate two markers, fca23 and fca90 nancycats$loc.names # they correspond to L2 and L7 temp <- nancycats$loc.fac=="L2" | nancycats$loc.fac=="L7" obj <- nancycats[,temp] obj obj$loc.fac obj$loc.names