I'm doing some single-locus simulations and wanted to use basic.stats, but ran into the problem that this does not work with only a single locus. See following test script:
library(hierfstat)
make a genotype array
Pop = rep(c(1,2), each=20)
Loc1 = sample(c(11,12,21,22),40, replace=TRUE)
dats = cbind(Pop, Loc1)
basic.stats(dats) #gives error: Error in apply(data[, -1], 2, dum) : dim(X) must have a positive length
I'm doing some single-locus simulations and wanted to use basic.stats, but ran into the problem that this does not work with only a single locus. See following test script:
library(hierfstat)
make a genotype array
Pop = rep(c(1,2), each=20) Loc1 = sample(c(11,12,21,22),40, replace=TRUE) dats = cbind(Pop, Loc1) basic.stats(dats) #gives error: Error in apply(data[, -1], 2, dum) : dim(X) must have a positive length
to verify, now with two loci
Loc2 = sample(c(11,12,21,22),40, replace=TRUE) dats2 = cbind(Pop, Loc1, Loc2) basic.stats(dats2) #no problem