% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/calculate_entropy.R
\name{calculate_entropy}
\alias{calculate_entropy}
\title{Calculate Shannon Entropy}
\usage{
calculate_entropy(vctr, base = 2, precision = 6)
}
\arguments{
\item{vctr}{A vector (character, factor, or integer) representing categorical data.}

\item{base}{A numeric scalar. The base of the logarithm. Default is 2.}

\item{precision}{Integer. The number of decimal places to round the result to. Default is 6.}
}
\value{
A numeric scalar representing the entropy. Returns 0 if the vector contains
only one unique value or has length 0.
}
\description{
Computes the Shannon entropy of a categorical vector.
}
\details{
Entropy is calculated as \eqn{H(X) = -\sum p(x) \log_b p(x)}, where \eqn{p(x)}
is the proportion of observations belonging to category \eqn{x}.
}
\examples{
seq_vec = c("A", "A", "T", "G", "C", "A")
calculate_entropy(seq_vec)

# Pure homogeneity
calculate_entropy(rep("A", 10))

}
