shannon_cond_entropy: Conditional Shannon Entropy H(X|Y) i.e. "H(X given Y)"

Description Usage Arguments Value See Also Examples

View source: R/inftheo.R

Description

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

Usage

1
shannon_cond_entropy(.data, ..., na.rm = FALSE)

Arguments

.data

A tibble with the columns of interest

...

two columns (variables) selected (order is important)

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_entropy

Examples

1
2
3
4
5
6
# make an all-character version of mtchars
mt_tib <- as_tibble(mtcars) %>% mutate_all(as.character)
shannon_cond_entropy(mt_tib, vs, am)
shannon_cond_entropy(mt_tib, 'vs', 'am')
shannon_cond_entropy(mt_tib, starts_with('c'))
shannon_cond_entropy(mt_tib, 9:8)

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