entropy {experDesign}R Documentation

Calculates the entropy

Description

Calculates the entropy of a category. It uses the amount of categories to scale between 0 and 1.

Usage

entropy(x)

Arguments

x

A character or vector with two or more categories

Value

The numeric value of the Shannon entropy scaled between 0 and 1.

Note

It omits the NA if present.

Examples

entropy(c("H", "T", "H", "T"))
entropy(c("H", "T", "H", "T", "H", "H", "H"))
entropy(c("H", "T", "H", "T", "H", "H", NA))
entropy(c("H", "T", "H", "T", "H", "H"))
entropy(c("H", "H", "H", "H", "H", "H", NA))

[Package experDesign version 0.3.0 Index]