% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/column.R
\name{col_def}
\alias{col_def}
\title{Define a table column}
\usage{
col_def(
  key,
  header = NULL,
  format = function(x) base::format(x),
  color = NULL,
  rollup = "sum",
  width = NULL
)
}
\arguments{
\item{key}{Character. The value key — the column name in your data frame (or
the name used in each node's \code{.values} list).}

\item{header}{Character. Column header text. Defaults to a title-cased
version of \code{key} (e.g. \code{"market_cap"} → \code{"Market Cap"}).}

\item{format}{Function \verb{function(x) -> character} for display formatting.
Defaults to \code{\link[base:format]{base::format()}}.}

\item{color}{Function \verb{function(x) -> CSS color string}, or \code{NULL}.
Default \code{NULL}.}

\item{rollup}{How parent rows are aggregated. Either a shortcut string
(\code{"sum"} or \code{"mean"}) or a function \verb{function(vals, child_values) -> scalar}. \code{vals} is a numeric vector of children's values for this column;
\code{child_values} is the full list of each child's value lists (useful for
weighted aggregation via \code{\link[=weighted_rollup]{weighted_rollup()}}). Defaults to \code{"sum"}.}

\item{width}{CSS width string (e.g. \code{"120px"}, \code{"10\%"}) applied to the
column header and every data cell. \code{NULL} (default) leaves width unset.}
}
\value{
A named list describing the column.
}
\description{
Define a table column
}
