I am working with the iris dataset to create histograms for the four numerical variables with individual sliders for specifying a maximum value for the variable, i.e., the slider for “Sepal.Width” could be adjusted from 2.2 to 4.4 and if the user changes the slider to 3, then the histogram will only show those data points from 2.2 to 3. I tried giving it a go, but can't figure out how to proceed.
library(tidyverse)
library(shiny)
data(iris)
ui <- fluidPage(
titlePanel("Shiny app for IRIS data"),
sidebarLayout(
sidebarPanel(
# For selecting a required species
selectInput( "species", "Select Species to plot:",
choices = c("setosa" = 1,
"versicolor" = 2,
"virginica" = 3)),
# For selecting the max value for slider input
sliderInput("lengths1","Sepal Length", min=0.1,max=8.0,value = 4.0,step = 0.1),
sliderInput("lengths2","Sepal Width", min=0.1,max=8.0,value = 4.0,step = 0.1),
sliderInput("lengths3","Petal Length",min=0.1,max=8.0,value = 4.0,step = 0.1),
sliderInput("lengths4","Petal Width", min=0.1,max=8.0,value = 4.0,step = 0.1),
textInput("title", "Title", value = "Enter desired Title")
),
mainPanel( plotOutput(outputId = "plot1")
)
)
)
server <- function(input, output){}
shinyApp(ui, server)