Automatic formatting for tables that should "just work" for most use cases. For more fine-grained control, see formatting and padding.

fmt_table(
  df,
  dec_dig = 1,
  prop_dig = 3,
  corr_dig = 3,
  output = NULL,
  fmt_small = TRUE,
  keep_zero = FALSE
)

Arguments

df

A data frame or tibble to be formatted for printing in output.

dec_dig

The number of decimal places to include for numbers, e.g., dec_dig = 1 for 16.5.

prop_dig

The number of decimal places to include for numbers bounded between [0,1], e.g., prop_dig = 2 for .35.

corr_dig

The number of decimal places to include for numbers bounded between [-1,1], e.g., corr_dig = 3 for .205.

output

The output format of the table. One of "latex" or "html". Automatically pulled from document output type if not specified.

fmt_small

Indicator for replacing zero with < (e.g., .000 becomes <.001). Default is TRUE.

keep_zero

If fmt_small is TRUE, whether to preserve true 0s (e.g., 0.0000001 becomes <.001, but 0.0000000 stays .000).

Value

A tibble with the same rows and columns as df, with numbers formatted consistently and padded for alignment when printed.

See also

Other formatters: formatting, padding