3
votes

I have a question related to the sliderInput in R shiny. In the sliderInput, the value is a number. Some examples show that the number is $number. However, if I want to show the value of sliderInput as a time, say 10:00, 15:00, how should I do it? Thanks a lot.

1

1 Answers

0
votes

This is a partial answer, giving you some pointers that anyone with some JS knowledge can use. To the best of my knowledge, as of Shiny-0.5, you can achieve this only by writing some Javascript/JQuery.

If you are able to incorporate JQuery plug-ins into your UI.R Shiny app, this link has what you want.

  1. Use CSS style to make sure that the SliderInput labels get formatted the way you want. (Showing Date/Time as opposed to numbers.) I typically put any tags$head() styling code inside SideBarPanel() and it has worked.

  2. You will also need a Javascript function that takes in the input$number and returns a valid date/time. Link with code: This JQuery post has a javascript function that you should be able use (with DatePicker)

Hope that helps.