min.dist [names(hap.vec)[is.na(hap.vec)],,drop = FALSE]中的错误:下标超出范围

时间:2019-07-31 02:57:17

标签: r

我正在尝试获取一组DNA样品的多样性统计信息,但是却收到此错误代码:min.dist [names(hap.vec)[is.na(hap.vec)]中的错误,drop = FALSE ]:下标超出范围。

stratastat<-function(x,pop=pop,fun=nuc.div){
#this function will calculate stats for a DNAbin object (x), stratified across populations given in pop. 
# Some functions this will work with: nuc.div(), theta.s(), tajima.test() from pegas, FusFs(), exptdHet() from strataG,
stats<-NULL
for(p in unique(pop)){
  stat<-fun(pis[grep(p,names(pis))])
  stats<-c(stats,stat)
}
names(stats)<-unique(pop)
return(stats)
}
stratastat(pis,pop=pop,fun=nuc.div)

stratastat(pis,pop=pop,fun=fusFs)

0 个答案:

没有答案