Multiple values not getting displayed in output based on multiple input selection from dropdown in R shiny

classic Classic list List threaded Threaded
2 messages Options
Rit
Reply | Threaded
Open this post in threaded view
|

Multiple values not getting displayed in output based on multiple input selection from dropdown in R shiny

Rit
Hi All,

Happy New Year to All.

I have been trying to create a multi input select list/dropdown using r
shiny but when i select more than two values from the input,it doesn't show
the output for all the values selected in the dropdown.

The code is as follows:

knitr::opts_chunk$set(echo = TRUE)
library(shiny)

ui <- fluidPage(
selectInput("Region","Select
Region",max_usage_hours_per_region$Region,multiple=TRUE),
tableOutput("table")
)
server <- function(input, output) {
output$table <- renderTable(
max_usage_hours_per_region[max_usage_hours_per_region$Region==input$Region,])}
shinyApp(ui = ui, server = server)

  max_usage_hours_per_region is a dataframe with the following output:-

    Region Sum_as_Hours
1   Africa    1156.0833
2 Americas     740.1667
3     APAC     740.2833
4   Europe    1895.2000
5      PDO    1053.3500
6       UK       0.0000


Can anyone help with the same.

Thanks.

Regards,
Ritwik

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple values not getting displayed in output based on multiple input selection from dropdown in R shiny

Bert Gunter-2
Shiny is an R package from RStudio, a wholly separate organization from R.
So note, per the posting guide linked below,

"For questions about functions in standard packages distributed with R (see
the FAQ Add-on packages in R
<http://cran.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R>), ask
questions on R-help
If the question relates to a *contributed package* , e.g., one downloaded
from CRAN, try contacting the package maintainer first. You can also use
find("functionname") and packageDescription("packagename") to find this
information. *Only* send such questions to R-help or R-devel if you get no
reply or need further assistance. This applies to both requests for help
and to bug reports."

RStudio maintains their own help resources  and there may even be something
specifically devoted to Shiny. So their site is where you should go for
help, not here (though you might get lucky and get a reply here).

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Jan 1, 2021 at 3:59 AM Ritwik Mohapatra <[hidden email]> wrote:

> Hi All,
>
> Happy New Year to All.
>
> I have been trying to create a multi input select list/dropdown using r
> shiny but when i select more than two values from the input,it doesn't show
> the output for all the values selected in the dropdown.
>
> The code is as follows:
>
> knitr::opts_chunk$set(echo = TRUE)
> library(shiny)
>
> ui <- fluidPage(
> selectInput("Region","Select
> Region",max_usage_hours_per_region$Region,multiple=TRUE),
> tableOutput("table")
> )
> server <- function(input, output) {
> output$table <- renderTable(
>
> max_usage_hours_per_region[max_usage_hours_per_region$Region==input$Region,])}
> shinyApp(ui = ui, server = server)
>
>   max_usage_hours_per_region is a dataframe with the following output:-
>
>     Region Sum_as_Hours
> 1   Africa    1156.0833
> 2 Americas     740.1667
> 3     APAC     740.2833
> 4   Europe    1895.2000
> 5      PDO    1053.3500
> 6       UK       0.0000
>
>
> Can anyone help with the same.
>
> Thanks.
>
> Regards,
> Ritwik
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.