dt_styler: Generate Datatable with Formatted Styling

Description Usage Arguments Details Examples

Description

dt_styler( ) generates a datatable with style formatting that will "color" the rows that belong to the two key variables by coloring them according to the two colors assigned to the two key variable. dt_styler ( ) can be used for any two variables from a dataset and with any two colors from a dataset.

Learn more in vignette ("covid19BFI")

Usage

1
dt_styler(data, id, key1, key2, clr1, clr2, plength, rownames = FALSE)

Arguments

data

A data frame that contains the data to be output in the datatable.

id

The column name that contains the key variables and will be used as an index for the function to identify.

key1

A single argument that is the first key variable that is chosen to have each of its rows highlighted by being colored in the chosen color.

key2

A single argument that is the second key variable that is chosen to have each of its rows highlighted by being colored in the other chosen color.

clr1

The first color that will highlight all the rows that are associated with key1.

clr2

The *second color that will highlight all the rows that are associated with key1.

plength

The argument the specifies the number of rows to be displayed in the table on the first page. Can take up to any number between 1 and the maximum length of the dataset.

rownames

Will create the first column as an index with the row numbers for each row when set to TRUE, rownames will not be shown when set to FALSE.

Details

The drop down page length selection is fixed at 7, 10, 15 and 20.

a datatable with colored rows according to the two chosen key variables.

Examples

1
2
3
4
5
6
7
## Not run:  
dt <- iris %>% filter(Species %in% c("setosa", "versicolor"))

#Builds a datatable of length 10, with red and blue rows.
dt_styler(dt, "Species", "setosa", "versicolor", "blue", "red", 10, rownames = FALSE) 

## End(Not run)

etc5523-2020/r-package-assessment-samuellyu-2021 documentation built on Jan. 1, 2021, 1:13 a.m.