R/entropy.R

Defines functions entropy

Documented in entropy

#'@title Calculates the entropy
#'@name entropy
#'
#'@description A function that calculates the entropy
#'
#'@param x The probabilities P0 and P1
#'
#'@return Returns the entropy
#'@author Murilo Montanini Breve
entropy <- function(x){
	entrop <- 0
	if (x > 0)
		entrop <- (-(x * log2(x)))
	if (is.nan(x) == TRUE)
		entrop <- 0
	return(entrop)
}

Try the BASiNETEntropy package in your browser

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

BASiNETEntropy documentation built on Aug. 17, 2023, 1:06 a.m.