Hello Zhian,
I am trying to run a multi-level AMOVA with a SNP dataset (diploid organism, 9,568 loci), and I am having a little bit of trouble. Here is my workflow:
1) Convert dataframe to genind object
2) Define and split strata
3) Run AMOVA
The conversion to genind object works, but I am unable to define the columns that list the individuals and their population (individuals are the first column, Population is the second column): This is the script I am using:
Mpol_genind <- df2genind(Mpol_wout_USDA, sep = NULL, ncode = 1, ind.names = NA,
loc.names = NULL, pop = NA, NA.char = "99", ploidy = 2,
type = c("codom", "PA"), strata = NULL, hierarchy = NA)
I have tried listing the column names to ind.names and pop, but they cannot be found. This is probably something very obvious that I am missing (not great with R).
So, I imagine this is why when I try to go on and define the strata that I get an error message stating that the strata is Empty. Eventually I would like to split the strata into Populations within a Range, but I would like to solve this problem first.
Here is my attempt at running an AMOVA, although it did not really have a chance at working since there was no defined strata:
Mpol_genid_amova <- poppr.amova(Mpol_genind, hier = "Range_Population", clonecorrect = FALSE, within = TRUE,
dist = NULL, squared = TRUE, correction = "quasieuclid",
sep = "", filter = FALSE, threshold = 0,
algorithm = "farthest_neighbor", missing = "loci", cutoff = 0.05,
quiet = FALSE, method = c("ade4", "pegas"), nperm = 0)
Any obvious fixes to this?
Thank you so much,
-Emily