Multiple linear regressions in a reactive environment

Hi there,

I see this post hasn't received any responses yet. I am pretty sure you can fix most of your problems here with quasiquoation. Have a look here: 19 Quasiquotation | Advanced R and here: Tidy evaluation is one of the major feature of the latest versions of dplyr and tidyr. - RStudio

See this reprex below of it in action. You should be able to do something similar for your problem.

## Only run examples in interactive R sessions
if (interactive()) {

library(ggplot2)

# single selection
shinyApp(
  ui = fluidPage(
    varSelectInput("variable", "Variable:", mtcars),
    plotOutput("data")
  ),
  server = function(input, output) {
    output$data <- renderPlot({
      ggplot(mtcars, aes(!!input$variable)) + geom_histogram()
    })
  }
)


# multiple selections
## Not run: 
shinyApp(
 ui = fluidPage(
   varSelectInput("variables", "Variable:", mtcars, multiple = TRUE),
   tableOutput("data")
 ),
 server = function(input, output) {
   output$data <- renderTable({
      if (length(input$variables) == 0) return(mtcars)
      mtcars %>% dplyr::select(!!!input$variables)
   }, rownames = TRUE)
 }
)
## End(Not run)

}

I'd be willing to help you if you create a cleaner/simpler reprex (FAQ: How to do a minimal reproducible example ( reprex ) for beginners)