0
votes

A simple question that's confounded me related to the reactivity within R Shiny.

My desired final output is a simple list, as below:

Selected Entities: {list that's reactive based on entities selected in checkbox input}

My problem is that I do not know how to get the "Selected Entities:" part to only show up once. I have tried several variations, including trying to use the paste function in the ui.R output section, in the renderText function in server.R, and within the reactive function in which I aggregate the chosen entities.

What I've landed at is the following (this is the last case from above):

paste("Selected entities:",input$thing[1:length(input$thing)])

The output here gives all the selections but prefaces every single one with the "Selected companies:", which looks quite ugly.

Thanks for helping an R beginner!

1

1 Answers

1
votes

Collapse the input$thing first:

paste("Selected entities:", paste(input$thing, collapse = ", "))

Here's a reproducible example:

paste("Letters:", paste(letters[1:5], collapse = ", "))