R/calc.intersp.het.R

Defines functions calc.intersp.het

Documented in calc.intersp.het

calc.intersp.het <-
function(introgress.data=NULL){
  if (is.null(introgress.data)==TRUE)
    stop("error, input data were not provided")
  if (is.list(introgress.data)==TRUE){
    count.matrix<-introgress.data[[2]]
  }
  else count.matrix<-introgress.data
  n.ind<-dim(count.matrix)[2]
  int.het<-numeric(n.ind)
  for (j in 1:n.ind){
    int.het[j]<-sum(count.matrix[,j]==1,na.rm=TRUE)/sum(is.na(count.matrix[,j])==FALSE)
  }	
  return(int.het)
}

Try the introgress package in your browser

Any scripts or data that you put into this service are public.

introgress documentation built on May 2, 2019, 7:24 a.m.