1
votes

I have the following sliderInput:

slider <- sliderInput(
inputId = 'slider1',
label = 'Select value',
min = min(vector1),
max = max(vector1),
value = vector1,
step = (max(vector1)-min(vector1))/5
)

When the Shiny app starts, the min and max values of the slider are the one on top of the other, like this: https://i.stack.imgur.com/eLp9J.jpg

Can I set the min and max values that the slider will have when the app starts?

1
Did you mean to set the value to a value within vector1, you can't set a value to an entire vector, that line doesn't make sense to me. Also why are you saving the input to a variable; that's not necessary -- you can't reuse the variable anyway because of how shiny objects namespace uniquelylatlio
Thank you! You are right, I needed to set value to c(min(vector1), max(vector1))chilipepper

1 Answers

1
votes

The value needs to be set to c(min(vector1), max(vector1)) instead of the whole vector1:

  sliderInput(
    inputId = 'slider1',
    label = 'Select value',
    min = min(vector1),
    max = max(vector1),
    value = c(min(vector1), max(vector1)),
    step = (max(vector1)-min(vector1))/5
    )

The assignment of the input to a variable has also been removed because, as latlio pointed out, it might cause namespacing issues.