R/shannonbio.R

"shannonbio" <-
function(data1){

    tot<-tapply(data1[,2],data1[,1],sum)
    tot<-tot[!is.na(tot)]
    tot<-tot/sum(tot)
    tot<-tot*(log(tot))/log(2)
    h<-sum(tot[is.finite(tot)])
    hmax<-log(1/length(tot))/log(2)
    c(H=-h,J=h/hmax)
}

Try the pgirmess package in your browser

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

pgirmess documentation built on May 29, 2024, 4:26 a.m.