entropy: Entropy

Description Usage Arguments Value Examples

View source: R/metrics.R

Description

Entropy

Usage

1
entropy(x, margin = 2L)

Arguments

x

a numeric vector, matrix, or data.frame.

margin

In case of matrix or dataframe apply entropy by columns margin = 2L or by rows margin = 1L. Default 2.

Value

the sample entropy of the input.

Examples

1
2
3
4
5
col1 <-  c('False', 'False', 'True', 'True', 'True', 'True', 'False', 'True', 'False', 'False')
col2 <- c('True', 'False', 'False', 'False', 'True', 'True', 'False', 'False', 'False', 'False')
col3 <- c('a', 'b', 'c', 'a', 'a', 'a', 'l', 'a', 'l', 'a')
df <- data.frame("V1" = col1, "V2" = col2, "V3" = col3)
entropy(df)

AnderEhu/sme documentation built on Jan. 31, 2022, 12:01 a.m.