dt_setup: Set DT::datatable options

Description Usage Arguments Value Examples

View source: R/utils_helpers.R

Description

Set DT::datatable options

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
dt_setup(
  data,
  n_rows = 10,
  lineHeight = "80%",
  dom_opt = "tip",
  cols_to_round = NULL,
  dt_options = NULL,
  sig_digits = 3,
  regex = FALSE,
  selection = "single",
  table_lengths = c(10, 20, 50, 100),
  filter_pos = "none",
  show_rownames = FALSE
)

Arguments

data

A tibble or dataframe.

n_rows

The number of rows to display (integer).

lineHeight

The height of each row in table (percentage). Default "80%".

dom_opt

dom options for table components:

  • l - length changing input control

  • f - filtering input

  • t - table

  • i - table info

  • p - pagination Any combination of these options should be supplied as a single character string and will be displayed in the order supplied. Default: "tip" (table, info, pagination).

cols_to_round

columns to round (vector of column numbers). See sig_digits. Default: NULL

dt_options

list of options to supply to datatable(). The default is NULL, meaning options are taken from the relevant supplied parameters, i.e. dom, pageLength = n_rows, lengthMenu = table_lengths. This argument is for if further customisation is required.

sig_digits

The number of significant digits to round to if cols_to_round is not NULL. Default: 3

regex

If TRUE, this allows regex searchng of the table e.g. gene1 | gene2.

selection

Whether to allow multiple rows to be selected at once, or just a single row. Either "multiple" or "single". Default: "single"

table_lengths

Integer vector of available table lengths. Default: c(10,20,50,100). This will only show if dom_opt includes "l".

filter_pos

Location of column filters. One of c("none", "bottom", "top"). Default: "none"

show_rownames

Whether to show rownames or not. Default: FALSE

Value

DT::datatable() object

Examples

1

laurabiggins/spex documentation built on Dec. 27, 2021, 8:14 p.m.