Hi all,
below is the reprex code. The code is fine, but actually as soon as I open the app, I need only 2 rows of the iris table displayed (Like this should be mandatory without any filter and submit button). then as per the filter and submit button the table should be displayed. can we achieve this?
---
title: "Untitled"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(dplyr)
library(DT)
library(shinycssloaders)
library(DT)
library(rhandsontable)
library(shinyjs)
library(dplyr)
library(shiny)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
selectInput("Tic","",choices = c("","ALL",as.character(iris$Species)),selected = NULL)
actionButton("Submit","Submit")
textOutput("Total")
tableOutput("SUMMARY_GENERAL_table")
data1 <- eventReactive(input$Submit,{
if(input$Tic == "ALL"){
table_display <- iris
}
else {
table_display <- iris %>% filter(Species %in% input$Tic)
}
})
output$SUMMARY_GENERAL_table <- renderTable(
data1()
)
output$Total <- renderText(
paste0("Sum ",formatC(as.numeric(sum(data1()[(data1()$Species == "setosa"),]$Sepal.Width))))
)
```