% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/clean_variable_names.R
\name{clean_variable_names}
\alias{clean_variable_names}
\title{Standardize and Clean Variable Names}
\usage{
clean_variable_names(data)
}
\arguments{
\item{data}{A \code{data.frame}. The data frame with messy column names.}
}
\value{
A \code{data.frame} with the same data but standardized column names.
}
\description{
\code{clean_variable_names()} standardizes column names in a messy data frame. It converts all names
to snake_case, strips special characters (except \verb{_}), translates Excel serial dates (e.g., \code{44197})
into ISO date strings (\code{2021-01-01}), and maps common financial/academic synonyms (e.g., \code{gvkey},
\code{permno}, \code{cusip}) to standard names (\code{id}, \code{ticker}).
}
\examples{
# Toy example: standardize column names in a data frame
df <- data.frame(
  `Total Revenue ($)` = 1,
  `PERMNO` = 3,
  `My Custom Column!` = 4,
  check.names = FALSE
)
clean_df <- clean_variable_names(df)
colnames(clean_df)
# Returns: c("revenue", "id", "my_custom_column")

# Excel serial dates are also handled
df2 <- data.frame(`44197` = 2, check.names = FALSE)
colnames(clean_variable_names(df2))
# Returns: "2021-01-01"

}
