Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R shiny slider increments

Tags:

r

slider

shiny

Trying to setup a slider bar range from 0.5 - 999.5 with increments of 1 such that the range of values that it can take on is 0.5, 1.5, 2.5 ... 999.5 . My problem is that when I use the the slider from the code below, I get values including whole integer 1, 2, 3, 4...etc I have tried changing the steps to 0.5 but then I get, 1, 1.5, 2, 2.5 ...etc. Any ideas?

column(4,
         fileInput("pbs", label = ("PBS File input")),
         sliderInput("size", 
                     label = ("Size Range Selection"), 
                     min = 0.5, 
                     max = 999.5, 
                     value = c(0.5,999.5),
                     step = 1,
                    round = F

         )
like image 795
user3749759 Avatar asked Oct 21 '25 08:10

user3749759


1 Answers

So this is not the greatest, but it will work:

In your ui:

  sliderInput("size", 
                     label = ("Size Range Selection"), 
                     min = 0, 
                     max = 999, 
                     value = c(0,999),
                     step = 1,
                    round = F,
                    post=".5"
         )

This will show a slider that goes from 0 to 999, but it adds ".5" to the labels so it will look like 0.5 to 999.5.

Then, in your server, you will have to add .5 to each of the values from the slider before using the numbers.

like image 178
John Paul Avatar answered Oct 23 '25 22:10

John Paul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!