% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/table_default.R
\name{table_default}
\alias{table_default}
\title{Display a formatted table in the console}
\usage{
table_default(
  x,
  justify_cols = "center",
  digits = 3,
  digits_by_col = NULL,
  scientific = FALSE,
  na_print = "",
  min_width = NULL,
  border_char = options("tab_default")$tab_default$border_char,
  show_row_names = FALSE,
  center_table = FALSE,
  n_space = 2,
  title = NULL,
  style_colnames = NULL,
  style_columns = NULL,
  nrows = getOption("tab_default")$nrows,
  vb = list(),
  auto_wrap = TRUE,
  wrap_threshold = 1,
  ...
)
}
\arguments{
\item{x}{A data frame or tibble.}

\item{justify_cols}{Alignment: a single string, vector, or named list of "left"/"right"/"center".}

\item{digits}{Digits to round numeric columns to. Default \code{3}.}

\item{digits_by_col}{Named list of per-column digit overrides.}

\item{scientific}{Display numerics in scientific notation? Default \code{FALSE}.}

\item{na_print}{String for missing values. Default \code{""}.}

\item{min_width}{Minimum column width. Default \code{NULL}.}

\item{border_char}{Character for borders. Default \code{"\\u2500"}.}

\item{show_row_names}{Show row names? Default \code{FALSE}.}

\item{center_table}{Center table in terminal? Default \code{FALSE}.}

\item{n_space}{Spaces between columns. Default \code{2}.}

\item{title}{Optional title string above the table.
from \code{\link[=td_style]{td_style()}}, or a named list where each name is a column name or
\code{"title"}, and each value is either a cli style string (e.g. \code{"blue_bold"})
or a function \verb{\\(ctx) ...} receiving a context list.}

\item{style_colnames}{Styling for column header cells. A \code{td_style} object
from \code{\link[=td_style]{td_style()}}, or a named list where each name is a column name or
\code{"title"}, and each value is either a cli style string (e.g. \code{"blue_bold"})
or a function \verb{\\(ctx) ...} receiving a context list.}

\item{style_columns}{Styling for data cells. A \code{td_style} object from
\code{\link[=td_style]{td_style()}}, or a named list where each name is a column name or column
index as a string, and each value is a cli style string or a function
\verb{\\(ctx) ...} receiving a context list with elements \code{value},
\code{formatted_value}, \code{col_name}, \code{col_index}, \code{is_header}, \code{data},
\code{justify}, and \code{width}.}

\item{nrows}{Max rows to display before truncation.}

\item{vb}{Vertical border spec: \code{list(char = "\\u2502", after = c(1, 3))}.}

\item{auto_wrap}{Auto-wrap wide tables? Default \code{TRUE}.}

\item{wrap_threshold}{Fraction of console width before wrapping. Default \code{1}.}

\item{...}{Reserved for future use.}
}
\value{
Invisibly returns the input data as a character matrix after
formatting has been applied. The function is called primarily for
its side effect of printing a styled table to the R console.
Returns \code{invisible(NULL)} early if the input has 0 rows and 0 columns,
or if it has 0 columns.
}
\description{
Display a formatted table in the console
}
\examples{
table_default(head(mtcars))
table_default(head(mtcars), style_columns = td_style(mpg = "cyan", cyl = "magenta"))

}
