Skip to contents

Adds a table to a webpage, based on specified or selected variables.

Usage

output_table(variables = NULL, dataset = NULL, dataview = NULL,
  id = NULL, click = NULL, subto = NULL, options = NULL,
  features = NULL, filters = NULL, wide = TRUE, class = "compact",
  datatables = TRUE)

Arguments

variables

The ID of a variable selecting input, or a list specifying columns (if wide is TRUE) or included variables. Each entry should be a list with at least have a name entry with a variable name. A title entry can be used to set a different display name for the variable. name can also refer to feature names, which can be specified with a source entry set to "features". For example, list(title = "Variable A", name = "a", source = "features"). A vector can also be used to specify variable names, with names setting titles (e.g., c("Variable A" = "a")). If not specified, sources are attempted to be resolved automatically.

dataset

The name of a dataset, or ID of a dataset selector, to find variables in; used if dataview is not specified.

dataview

The ID of an input_dataview component.

id

Unique ID of the table.

click

The ID of an input to set to a clicked row's entity ID.

subto

A vector of output IDs to receive hover events from.

options

A list of configuration options if datatables is TRUE, see DataTables Documentation; otherwise, only the scrollY option has an effect.

features

A list of features columns to include if multiple variables are included and wide is TRUE.

filters

A list with names of meta entries (from variable entry in data_add's meta list), and values of target values for those entries, or the IDs of value selectors.

wide

Logical; if FALSE, variables and years are spread across rows rather than columns. If variables specifies a single variable, wide = FALSE will show the variable in a column, and wide = TRUE will show the variable across time columns.

class

Class names to add to the table.

datatables

Logical; if TRUE, uses DataTables.

Value

A character vector of the content to be added.

Examples

output_table()
#> [1] "<table class=\"auto-output tables compact\" id=\"table\" data-autoType=\"datatable\"></table>"