I'd like to add a short description of a dataset that's been previously selected for visualization (via selectInput). I am struggling to create a reactive output so that that a chunk of text (3-4 sentences) that corresponds to the selected input is shown, ideally in the sidebar panel. I am also not sure where to load the written descriptions so as not to overwhelm the code with text.
df <- data.frame(
indicator = c("Fruits", "Vegetables"),
description = c("This basket contains apples, oranges and lemons.",
"This basket contains cucumbers, onions and cauliflower.")
)
ui <- tagList(
navbarPage("Fruit salad",
tabPanel("Pick your ingredients",
sidebarPanel(
# First input: user-chosen variable
selectInput(inputId = "variable.name",
choices = indicators),
# This should print the description based on the selected indicator
textOutput(outputId = "short.descript")
)
)
)
)
server <- function(input, output) {
output$short.descript <- renderText({
# here a function printing the description based on the "variable.name"
})
}
I tried adding textOutput to the sidebar panel, but I don't know how to connect it with the previously selected input.
Thanks for any tips! P.S. I'm new to Shiny, no making fun of me please :-)