简体   繁体   中英

RShiny - overly reactive output

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!

Collapse the input$thing first:

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

Here's a reproducible example:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM