Hi @andresrcs
Background information
I have this interface
Considerations:
Initially the report tab is empty.
Process Flow:
-
When you select what you want to filter, including the variable slider, then
you press the "Apply Filters" button and then below of the title "Detail of dataset" will appear a renderTable() with the filtered dataset.
Also, It'll appear a "Run Analysis" button.
This execution is using this¬
output$table1 <- DT::renderDataTable(DT::datatable({
result <- dataset
if (input$filter_1 != "Todo"){
result <- result[result$value1 == input$filter_1,]
}
if (input$filter_2 != "Todo") {
result <- result[result$value2 == input$filter_2,]
}
if (input$filter_3 != "Todo") {
result <- result[result$value3 == input$filter_3,]
}
result
result
}))
2. When you press the "Run Analysis" button. It will take the filtered dataset and procede to run something else.
This execution is using this ¬
observeEvent(input$Run, {
output$table2 <- renderTable({
here I run my analysis and I put the result dataset at the end
})
})
- Finally, the table with the result will appear in the "Report" tab and also a "Download .csv" using the following code in the ui component ¬
tabPanel(
title = 'Report',
value = "tab2",
tableOutput('table2'),
downloadButton("downloadData", "Download (.csv)")
)
Inconvenient:
When I tried to write my code to download the final report. I realized that I needed to run the analysis again to get the dataset and then be able to download it.
Other issues:
I also realized that I have to run the filtering code to reproduce the same filtered dataset to run my main analysis