I am trying to set the x-axis limits of my reactive histograms in a shiny app to be constant. For example, regardless of the data i simulate, I would always like to have 200 breaks between 0 and 3000 (any frequencies spilling over 3000, or below 0, should be truncated out).
Is there a simple way of getting this done?
I've tried the following based on an idea here:
histSims <- reactive({
#return
hist(beanSims()[beanSims() > 1 & beanSims < 3000],
breaks = 200,
prob = T)
followed by
output$plot4 <- renderPlot({
plot(histSims()
))
})
But I get
Error: comparison (3) is possible only for atomic and list types