adegenet
adegenet copied to clipboard
rbind genlight objects does not work for missing populations
This issue came up in #209, when I was trying to make a reprex, I noticed that I would get an error when I attempted to even up the number of markers by adding in structured SNPs. I believe this error is due to the fact that one data set has a population factor and the other does not.
library("adegenet")
#> Loading required package: ade4
#>
#> /// adegenet 2.1.1 is loaded ////////////
#>
#> > overview: '?adegenet'
#> > tutorials/doc/questions: 'adegenetWeb()'
#> > bug reports/feature requests: adegenetIssues()
(pop1_sim <- glSim(100, n.snp.nonstruc=200, n.snp.struc = 100, ploidy=2))
#> /// GENLIGHT OBJECT /////////
#>
#> // 100 genotypes, 300 binary SNPs, size: 148.4 Kb
#> 0 (0 %) missing data
#>
#> // Basic content
#> @gen: list of 100 SNPbin
#> @ploidy: ploidy of each individual (range: 2-2)
#>
#> // Optional content
#> @pop: population of each individual (group size range: 43-57)
#> @other: a list containing: ancestral.pops
(pop2_sim <- glSim(100, n.snp.nonstruc=300, ploidy=2))
#> /// GENLIGHT OBJECT /////////
#>
#> // 100 genotypes, 300 binary SNPs, size: 147.6 Kb
#> 0 (0 %) missing data
#>
#> // Basic content
#> @gen: list of 100 SNPbin
#> @ploidy: ploidy of each individual (range: 2-2)
#>
#> // Optional content
#> @other: a list containing: ancestral.pops
pops <- rbind(pop1_sim, pop2_sim)
#> Error in `pop<-`(`*tmp*`, value = structure(c(1L, 1L, 1L, 1L, 1L, 1L, : Vector length does no match number of individuals