Question

I'm doing an application on shiny, and I want to plot the linear regression only between two vertical abline that I could modify with sliders.

How can I do this?

shinyServer(function(input, output, session) {


output$plot.weibull <- renderPlot({   
PlotWeibull(my.data$X, my.data$Y)
if (input$fit.weibull) {
  FitWeibull(my.data)
  abline(FitWeibull(my.data), col = "blue")
  abline(v = log(input$reg.range), col = "blue", lty = 3)
    }
  })
})
Was it helpful?

Solution

Instead of the line abline(FitWeibull(my.data), col='blue') you should have:

lines(log(input$reg.range), FitWeibull(log(input$reg.range)), col=blue)

The second argument may give you an error, because input$reg.range needs to be in a format that FitWeibull() will accept.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top