R/cal_entropy.R

Defines functions cal_entropy

cal_entropy <-
function(x) {
  freqs <- table(x)/length(x)
  freqs = freqs[freqs>0]
  return(-sum(freqs * log(freqs))/log(length(x)))
}

Try the yaConsensus package in your browser

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

yaConsensus documentation built on April 3, 2025, 10:12 p.m.