sp_dable: Special Data Table

Description Usage Arguments Value

View source: R/table_utils.R

Description

This function is the wrapper of 'DT::datatable()' and set default values of some parameters frequently used. You can use 'sp_dable()' to output the caption reference-able and specify the columns to be sorted with DESC or ACS method. Auto detecting column names depending on global options is the most usefully function of this function. You can also set 'detect_colnames = FALSE' and then specify the 'colnames' with a character vector of column names of the data.

Usage

1
sp_dable(data, ref_text, detect_colnames = TRUE, colnames, order, ...)

Arguments

data

a data frame to be displayed with 'DT::datatable()'.

ref_text

a character. It can be text reference character like '"(ref:<label>)"' or the caption of table like '"Caption of table"'.

detect_colnames

logic, default TRUE. If set 'TRUE' then the function will detect colnames depending on the global options 'report.options$colnameMap' and the column names of 'data'.

colnames

character vector of column names. When you want to use auto-detection of column names, you can leave it missing since this function will not consider the parameter.

order

nested list of column index and sorting method. You can specify multiple columns to be sorted. Every sorting option is in the form of 'list(<index of column>, <sorting method>)' (Note that the index of column is begin at 0) and all sorting options should be put in a list. The sorting method can be "desc" or "acs".

...

other params of 'DT::datatable()' except 'data' and 'colnames'.

Value

None. But print HTML reference-able caption and HTML widget of DT::datatable.


YuanchenZhu2020/antgreens documentation built on Dec. 18, 2021, 8:20 p.m.