# let's look at the microbov data set:
data(microbov)
microgc <- as.genclone(microbov)
microgc
# We see that we have three vectors of different names here.
?microbov
# These are Country, Breed, and Species
names(other(microgc))
# Let's set the hierarchy
sethierarchy(microgc) <- data.frame(other(microgc))
microgc
# And change the names so we know what they are
namehierarchy(microgc) <- ~Country/Breed/Species
# let's see what the hierarchy looks like by Species and Breed:
head(gethierarchy(microgc, ~Breed/Species))
# Load our data set and convert it to a genclone object.
Aeut.gc <- read.genalex(system.file("files/rootrot.csv", package = "poppr"))
# we can see the hierarchy is set to Population_Subpopulation.
head(gethierarchy(Aeut.gc))
# We can use splithierarchy() to split them.
splithierarchy(Aeut.gc) <- ~Pop/Subpop
Aeut.gc
head(gethierarchy(Aeut.gc))
# We can also use gethierarchy to combine the hierarchy.
head(gethierarchy(Aeut.gc, ~Pop/Subpop))
# We can also give it a more descriptive name.
namehierarchy(Aeut.gc) <- ~Population/Subpopulation
Aeut.gc
Aeut.gc <- namehierarchy(Aeut.gc, ~Pop/Subpop)
Aeut.gc
Run the code above in your browser using DataLab