I am making my first shiny app- a histogram with a slider input. However, I want to use a user-defined function to produce output for this histogram. Here is the chunk of code regarding the histogram:
#Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
#Use the function for a constant risk, but sample uniformly over CI for OR
#95% CI: 1.19-1.41
myrisk<-input$risk
random<-runif(1000, min = 1.19, max = 1.41)
output<-sapply(random, myfunction, risk=myrisk)
hist(output, xlab="Number of Cases Prevented",
main="Histogram of 1000 Simulations")
})
}
Note: I have 'myfunction' defined earlier in the code, before I call in the shiny library. Does anyone see any indication why this won't be running?
I tried debugging it, and the trouble is coming from the 'output' line.
Thanks!