From e2b6d1e7d18a26b472c68f87e4bd85139c2fbb5c Mon Sep 17 00:00:00 2001 From: Vincent Arel-Bundock Date: Wed, 17 Jan 2024 11:26:45 -0500 Subject: [PATCH] docs --- R/tt.R | 3 ++- man/tt.Rd | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/R/tt.R b/R/tt.R index b951fecc..d013f3d6 100644 --- a/R/tt.R +++ b/R/tt.R @@ -4,7 +4,7 @@ #' #' @param x A data frame or data table to be rendered as a table. #' @param output The format of the output table. Can be "html", "latex", or "markdown". If NULL, the format is automatically detected in Quarto or Rmarkdown documents. -#' @param digits Number of significant digits to keep for numeric variables. When `digits` is not `NULL` +#' @param digits Number of significant digits to keep for numeric variables. When `digits` is an integer, `tt()` calls `format_tt(x, digits = digits)` before proceeding to draw the table. Users who need more control can proceed in two steps: (1) format the data with `format_tt()` or other functions, and (2) pass the formatted data to `tt()` for drawing. See `?format_tt` for more details on formating options (ex: decimal, scientific notation, dates, boolean variables, etc.). #' @param align A string specifying the alignment of columns. Each character in the string corresponds to a column; 'l' for left, 'c' for center, and 'r' for right alignment. The length of the string must match the number of columns in `x`. #' @param caption A string that will be used as the caption of the table. #' @param width A numeric value between 0 and 1 indicating the proportion of the line width that the table should cover. @@ -47,6 +47,7 @@ tt <- function(x, assert_string(caption, null.ok = TRUE) assert_string(align, null.ok = TRUE) assert_numeric(width, len = 1, lower = 0, upper = 1, null.ok = TRUE) + assert_integerish(digits, len = 1, null.ok = TRUE) # notes can be a single string or a (named) list of strings if (is.character(notes) && length(notes)) { diff --git a/man/tt.Rd b/man/tt.Rd index 322dcf4d..0b119045 100644 --- a/man/tt.Rd +++ b/man/tt.Rd @@ -21,7 +21,7 @@ tt( \item{output}{The format of the output table. Can be "html", "latex", or "markdown". If NULL, the format is automatically detected in Quarto or Rmarkdown documents.} -\item{digits}{Number of significant digits to keep for numeric variables. When \code{digits} is not \code{NULL}} +\item{digits}{Number of significant digits to keep for numeric variables. When \code{digits} is an integer, \code{tt()} calls \code{format_tt(x, digits = digits)} before proceeding to draw the table. Users who need more control can proceed in two steps: (1) format the data with \code{format_tt()} or other functions, and (2) pass the formatted data to \code{tt()} for drawing. See \code{?format_tt} for more details on formating options (ex: decimal, scientific notation, dates, boolean variables, etc.).} \item{align}{A string specifying the alignment of columns. Each character in the string corresponds to a column; 'l' for left, 'c' for center, and 'r' for right alignment. The length of the string must match the number of columns in \code{x}.}