To explain the issue, I created the simple app you see below. I have no problem using the mtcars dataset directly, but when the issue is reactive (or master in the example), I get the could not find function "master" error. No matter what I tried, I couldn't overcome this issue, so I'm asking for your assistance.
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
verbatimTextOutput("txt1"),
verbatimTextOutput("txt2")
)
)
server <- function(input, output) {
master <- reactive({
mtcars
})
model1 <- reactive({
olsrr::ols_step_both_p(lm(hp~.,data = mtcars))
})
model2 <- reactive({
olsrr::ols_step_both_p(lm(hp~.,data = master()))
})
output$txt1 <- renderPrint({
summary(model1()$model)
})
output$txt2 <- renderPrint({
summary(model2()$model)
})
}
shinyApp(ui, server)
Thanks in advance.