Skip to contents

Small wrapper around DT::datatable(). Will be used to create tables in a consistent style.

Usage

datatable_custom(
  data,
  rename_vars = NULL,
  title = NULL,
  selection = "single",
  extensions = "Scroller",
  plugins = "scrollResize",
  dom = "fti",
  options = list(),
  ...
)

Arguments

data

A data frame to use within the application.

rename_vars

An optional named character vector. If provided, it will rename any column names found in this vector to the provided name.

title

Optional. Character string with the title of the table.

selection

See DT::datatable(). Default set to 'single'.

extensions

See DT::datatable(). Default set to 'Scroller'.

plugins

See DT::datatable(). Default set to 'scrollResize'.

dom

See https://datatables.net/reference/option/dom. A div element will be inserted before the table for the table title. Default set to 'fti' resulting in 'f<"header h5">ti'.

options

See DT::datatable(). Must be a list.

  • Modifiable defaults:

    • scrollY = '400px'

    • scrollX = TRUE

    • scroller = TRUE

    • deferREnder = TRUE

    • scrollResize = TRUE

    • scrollCollapse = TRUE

  • Non-modifiable defaults:

    • dom: Defined by the dom parameter.

    • initComplete: Defaults to a function to insert table title into dataTable container.

...

Other optional arguments that will be passed to DT::datatable().

Value

A DT::datatable object.

Examples

datatable_custom(mtcars)