Interactive data tables in html

When putting together reports or exploring data, sometimes point-and-click sorting and filtering are helpful.

Key point: These interactive features do not alter the underlying data, as with e.g. opening dataset in Excel

DT

DT builds html widgets to display data in pretty formats.

Install and load library

install.packages('DT')
library(DT)

basic functionality: datatable()

Note lack of “.”

library(DT)
datatable(dat)

Examine resulting table object, noting:

options: filter, rows per page, etc

# add filter by factor or number to top of table
datatable(dat, filter = 'top')

datatable(dat, 
		rownames =  F, # displays rownames by default
		options = list(pageLength = 25)) # display 25 rows

Examine resulting table objects noting:

See extensive customization options reference page

Do Exercise 2: Add DT to R-markdown