tab_xl {tabxplor}R Documentation

Excel output for tabxplor tables, with formatting and colors

Description

To modify the colors used into the Excel table, you can change the global options with set_color_style and set_color_breaks.

Usage

tab_xl(
  tabs,
  path = NULL,
  replace = FALSE,
  open = rlang::is_interactive(),
  colnames_rotation = 0,
  remove_tab_vars = TRUE,
  colwidth = "auto",
  print_ci = FALSE,
  print_color_legend = TRUE,
  sheets = "tabs",
  n_min = 0,
  titles,
  hide_near_zero = "auto",
  color_type = "text"
)

Arguments

tabs

A table made with tab, tab_many or tab_plain, or a list of such tables.

path, replace, open

The name, and possibly the path, of the Excel file to create (possibly without the .xlsx extension). Default path to temporary directory. Set global option "tabxplor.export_dir" with link[base:options]{options} to change default directory. By default replace is TRUE when path is provided, FALSE when path is not provided. Use replace = TRUE to overwrite existing files. Use open = FALSE if you don't want to automatically open the tables in Excel (or another software associated with .xlsx files).

colnames_rotation

Rotate the names of columns to an angle (in degrees).

remove_tab_vars

By default, tab_vars columns are removed to gain space. Set to FALSE to keep them.

colwidth

The standard width for numeric columns, as a number. Default to "auto".

print_ci

Set to TRUE to print confidence intervals in another table, at the left of the base table.

print_color_legend

Should the color legends be printed with the subtexts ?

sheets

The Excel sheets options :

  • "tabs": a new sheet is created for each table

  • "unique": all tables are on the same sheet

  • "auto": subsequent tables with the same columns are printed on the same sheets

n_min

The total count under which a column or row is turned pale grey because there is not enough observation for it to be significant. Default to 0 (not used).

titles

The titles of the different tables, as a character vector. When missing titles are given based on the names of the variables.

hide_near_zero

By default all cells displayed as 0 (even rounded) turn pale grey, to make the distribution of empty cells (and other cells) more visible. Provide a number to turn grey every cell below it. Set to Inf not to use this feature.

color_type

By default, the text is colored. Set to "bg" to color the background instead.

Value

The table(s) with formatting and colors in an Excel file, as a side effect. Invisibly returns tabs.

Examples


forcats::gss_cat %>%
  tab(marital, race, pct = "row", color = "diff") %>%
  tab_xl()
  

[Package tabxplor version 1.1.3 Index]