12.7 Table using DT

  • Here we create the visualizations that will be included in the dashboard. First, we create an interactive table that shows the data by using the DT package (Figure 12.3). We use the datatable() function to show a data frame with variables ISO3, NAME, and PM2.5. We set rownames = FALSE to hide row names, and options = list(pageLength = 10) to set the page length equal to 10 rows. The table created enables filtering and sorting of the variables shown.
library(DT)

DT::datatable(map@data[, c("ISO3", "NAME", "PM2.5")],rownames = FALSE, options = list(pageLength = 10)
)