I have a question about datatable (DT) which i am using in Shiny.
I got quite big data (>5000000 rows), and i display it in shiny app using datatable (DT) with filters. Depending on the user preferences for filtering, lets assume it gives us 550 rows (but it can give us more or less than that). Because of pagination I am not able to see all 550 rows (assuming pageLength is 100) or whats even worse, i am not able to display all filtered rows further in a plot, as function input$tabelle_rows_all
uses the rows on the current page (i must first change the entries number).
Is there any way to get all found rows after filtering datatable (not depended on pageLength
)?
Example:
library(shiny)
library(DT)
library(ggplot2)
x <- as.numeric(1:1000000)
y <- as.numeric(1:1000000)
data <- data.frame(x,y)
shinyApp(
ui = fluidPage(dataTableOutput('tableId'),
plotOutput('plot1')),
server = function(input, output) {
output$tableId = renderDataTable({
datatable(data, options = list(pageLength = 100, lengthMenu=c(100,200,300,400,500,600)))
})
output$plot1 = renderPlot({
filtered_data <- data[input$tableId_rows_all, ]
ggplot(data=filtered_data, aes(x=x,y=y)) + geom_line()
})
}
)
Thanks for any Info