Hello,
I'm building a simple regression model to Shiny and looks like my server code has some errors. My UI is fine but when launching the app, it keeps showing me this error:
"no applicable method for 'svyglm' applied to an object of class "data.frame"
Can someone help me out with this? Thank you and appreciate. My codes as below
place.data <- read.csv("place_data.csv")
server <- function(input, output) {
model <- reactive({
svyglm(paste("Risk"," ~ ",paste(input$iv1,collapse="+")),family= quasibinomial, place.data)
})
output$regTab <- renderText({
stargazer(model(), type = "html", dep.var.labels = "Risk Prediction")
})
}
ui <- shinyUI(fluidPage(tabPanel(
"Analyzing ACEs",
headerPanel("ACEs Prediction Model"),
sidebarLayout(
position = "right",
sidebarPanel(
h2("Build your model"),
br(),
checkboxGroupInput(
"iv1",
label = "Select any of the independent variables below to calculate your model. You can change your selection at any time.",
c("Risk"="Risk",
"Poverty"="Poverty",
"Education"="Education",
"Unemployment"="Unemployment",
"Crime"="Crime",
"ACEs" = "ACEs"),
selected = "Risk"
)
),
mainPanel(br(),
tabsetPanel(
type = "tabs",
tabPanel(
"Regression Table",
h3("Table of Regression Coefficients"),
HTML('</br>'),
tableOutput("regTab"),
HTML('</br>'),
helpText("Describe the model")
)
)
)
)
)
)
)
shinyApp(ui = ui, server = server)