shannon_entropy: Shannon Entropy H(X)

Description Usage Arguments Value See Also Examples

View source: R/inftheo.R

Description

This calculates shannon entropy of a variable in a tibble. It's assumed these columns are character typed with no NAs.

Usage

1
shannon_entropy(.data, X, na.rm = FALSE)

Arguments

.data

A tibble with the column of interest

X

Name of the column

na.rm

remove all rows with NA values in at least one of the columns

Value

a double with the calculated value

See Also

shannon_cond_entropy

Examples

1
2
3
4
shannon_entropy(iris, Species)
iris %>% as_tibble() %>% shannon_entropy(Species)
shannon_entropy(iris, 'Species')
shannon_entropy(iris, 5)

tidyinftheo documentation built on Dec. 1, 2017, 1:01 a.m.