The DT
package is a wrapper of the JavaScript library 'DataTables', and is a powerful way of rendering HTML tables from R dataframes using JavaScript, usually via Markdown or Shiny. This package is mostly a wrapper around DT::datatable()
with more convenient defaults and simplified syntax.
The most common elements of the options() list argument are moved to direct arguments of the datatable_EZ()
function. This avoids the need to include a long list of options and provides additional documentation and examples of their usage.
Read the Interactive Data Tables vignette for some examples.
To install the development version:
devtools::install_github(repo = "datatableEZ",
username = "vadimus202",
build_vignettes = TRUE)
library(datatableEZ)
datatable(iris)
datatable_EZ(
iris,
dom="t",
columnDefs = list(list(width = '50px', targets = c(1, 3))),
order = list(list(0, 'desc'), list(1, 'asc'))
)
the DT package doesn't set the default font family. So the browser will use its default font to display the datatable. That's why you find the font displays differently in different browsers.
datatable_EZ(iris, font_family = "Courier New", font_size = 9)
datatable_EZ(
iris,
col_widths = c(50, 50, 300, 50, 300)
)
datatable_EZ(iris, pageLength = 3, lengthMenu = c(3,5,10))
Disables sorting and searching by the user.
datatable_EZ(iris, ordering = FALSE, dom = "t")
A simple way to add conditional formatting databars to one or more columns.
iris %>%
datatable_EZ() %>%
format_databars(~Sepal.Length + Sepal.Width + Petal.Length)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.