[R] shinyWidgets::sliderTextInput

Erin Hodgess er|nm@hodge@@ @end|ng |rom gm@||@com
Wed Aug 7 18:01:38 CEST 2019


Hi Sigbert


Here is something that has both the sliderTextInput and Radio Buttons,
which may be helpful:

library("shiny")

library("shinyWidgets")


ui <- fluidPage(

  br(),

  sliderTextInput(

    inputId = "mySliderText",

    label = "My House",

    choices = list("choice 1" = "choice 1","choice 2" ="choice 2",

    "choice 3" ="choice 3"),

    selected = "choice 1"

  ),


          radioButtons(inputId="slope", label="Radio Buttons",

               choices=list("Choice 1" = "Choice 1","Choice 2" = "Choice 2",

                 "Choice 3" = "Choice 3")),



  verbatimTextOutput(outputId = "result")

)


server <- function(input, output, session) {

  output$result <- renderPrint({

  str(input$mySliderText)

  str(input$slope)

}

)


}


shinyApp(ui = ui, server = server)



Hope this helps!


Sincerely,

Erin



Erin Hodgess, PhD
mailto: erinm.hodgess using gmail.com


On Wed, Aug 7, 2019 at 6:31 AM Sigbert Klinke <sigbert using wiwi.hu-berlin.de>
wrote:

> Hi,
>
> > Is there a label argument, please? I think that might be it.
>
> In my example I had a label, but this not the problem since
>
>  > choices=list("choice1"=1, "choice2"=2,"choice3"=3)
>  > as.character(choices)
> [1] "1" "2" "3"
>
> delivers the result as it is used in sliderTextInput. I was hoping there
> was a way to bypass that behaviour without changing the sliderTextInput
> function ;)
> The default action of selectInput using a list for choices is to show in
> the UI element the list names, but to deliver to the shiny app the
> number if one is selected.
>
> Thanks Sigbert
>
> --
> https://hu.berlin/sk
> https://hu.berlin/mmstat3
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list