information_content_discrete {eHDPrep}R Documentation

Calculate Information Content (Discrete Variable)

Description

Calculates information content of a discrete (categorical or ordinal) vector in bits (default) or natural units. Missing values are omitted from the calculation.

Usage

information_content_discrete(x, unit = c("bits"))

Arguments

x

Input vector

unit

Unit to measure entropy. Either "bits" (default) or "nats".

Value

Information content of input variable

Examples

data(example_data)
information_content_discrete(example_data$marital_status)

[Package eHDPrep version 1.2.1 Index]