tablesggSetOpt {tablesgg}R Documentation

Set the Values of Package Options

Description

Set the values of package options.

Usage

tablesggSetOpt(...)

Arguments

...

Arguments in tag = value form, or a list of tagged values. The tags must come from the names of package options described in DETAILS below. The named options will be set to the values provided.

Details

The new option values persist until the end of the R session or until they are changed by another call to this function or to tablesggOpt(reset=TRUE).

The options that may be set are:

entryStyle

A styleObj object, with element type entry. This is the default style for table entries.

blockStyle

A styleObj object, with element type block. This is the default style for blocks.

hvruleStyle

A styleObj object, with element type hvrule. This is the default style for hvrules.

plot.margin

A numeric vector of length 4, containing the amount of empty space to add around the four sides of a plotted table, in millimeters. The order of sides is top, right, bottom, left.

allowMarkdown

Logical scalar. If TRUE then text for table entries is allowed to contain markdown and HTML tags to control its appearance. TRUE is valid only if package ggtext is available.

allowWrap

Logical scalar. If TRUE then automatic wrapping of text for table entries is allowed. TRUE is valid only if packages ggtext and quadprog are available.

Facilities to handle markdown and automatic wrapping of entry text are provided by Claus Wilke's ggtext package (https://CRAN.R-project.org/package=ggtext). Therefore allowMarkdown and allowWrap can be set to TRUE only when that package has been installed. Note that only a subset of HTML tags are available.

Value

A list with the old values of the named options, invisibly.

See Also

tablesggOpt to get current values of options, or to reset options to their "factory-fresh" setting. styles_pkg for the set of package-provided table styles.

Examples

  oldopt <- tablesggOpt()
  tablesggOpt(reset=TRUE)
  plt1 <- plot(iris2_tab, title="Factory-fresh default styles")
  # Set new default style for table entries:
  tablesggSetOpt(entryStyle=styles_pkg$entryStyle_pkg_2)
  plt2 <- plot(iris2_tab, title="Changed default entry style")
  # Compare:
  print(plt1, vpy=0.75)
  print(plt2, vpy=0.25, newpage=FALSE)
  
  # Change the values of multiple options:
  tablesggSetOpt(list(hvruleStyle=styles_pkg$hvruleStyle_pkg_base, 
                      plot.margin=c(5, 5, 5, 5)))
  # ... plot some tables using the new defaults ...
  # Restore the old options:
  tablesggSetOpt(oldopt)
  identical(tablesggOpt(), oldopt)
  

[Package tablesgg version 0.9-1 Index]