При использовании фильтрации и функции verbatimTextOutput
в R Shiny строки, похоже, пропадают, когда я выбираю более одного из вариантов ввода в моем checkboxGroupInput
.
Ниже приведен мой код.Любой совет?
Заранее спасибо.
infantmort <- read.csv("infantmort.csv", header = TRUE)
ui <- fluidPage(
checkboxGroupInput("regioninputID",
"Select Region(s)",
choices = unique(infantmort$whoregion)
),
mainPanel(
verbatimTextOutput("regionoutputID"), width = "auto", height = "auto"
)
)
server <- function(input, output) {
dataset <- reactive({
as.data.frame(infantmort %>% select(whoregion, year, deathsinthousands) %>%
filter(whoregion == input$regioninputID) )
})
output$regionoutputID <- renderPrint({ dataset()
})
}
shinyApp(ui = ui, server = server)
![infantmort CSV file](https://i.stack.imgur.com/sthHa.png)
![One option selected - notice all 8 data points are visible](https://i.stack.imgur.com/z11Py.png)
![Two options selected - there should be 16 data points visible but there are only 8](https://i.stack.imgur.com/q8QLF.png)