powered by
This calculates shannon entropy of a variable in a tibble. It's assumed these columns are character typed with no NAs.
shannon_entropy(.data, X, na.rm = FALSE)
A tibble with the column of interest
Name of the column
remove all rows with NA values in at least one of the columns
a double with the calculated value
shannon_cond_entropy
# NOT RUN { shannon_entropy(iris, Species) iris %>% as_tibble() %>% shannon_entropy(Species) shannon_entropy(iris, 'Species') shannon_entropy(iris, 5) # }
Run the code above in your browser using DataLab