How to do datatable highlighting in R. The shiny implementation should be straight forward.
library(DT)
mtcars2 = head(mtcars[, 1:5], 20)
mtcars2$model = rownames(mtcars2)
rownames(mtcars2) = NULL
options(DT.options = list(pageLength = 5))
# global search
datatable(mtcars2, options = list(searchHighlight = TRUE, search = list(search = 'da')))
See here: R Studio DT Explanation
EDIT:
Small shiny example
server.R:
shinyServer(function(input, output) {
output$testme <- renderDataTable({
mtcars2 = head(mtcars[, 1:5], 20)
mtcars2$model = rownames(mtcars2)
rownames(mtcars2) = NULL
options(DT.options = list(pageLength = 5))
# global search
datatable(mtcars2, options = list(searchHighlight = TRUE, search =
list(search = 'da')))
})
})
ui.R:
library(shiny)
library(DT)
shinyUI(fluidPage(
DT::dataTableOutput(outputId = "testme")
)
)