Error in Shiny App


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 <- read.csv("place_data.csv")

server <- function(input, output) {
  model <- reactive({
    svyglm(paste("Risk"," ~ ",paste(input$iv1,collapse="+")),family= quasibinomial,
  output$regTab <- renderText({
    stargazer(model(), type = "html", dep.var.labels = "Risk Prediction")
ui <- shinyUI(fluidPage(tabPanel(
  "Analyzing ACEs",
  headerPanel("ACEs Prediction Model"),
    position = "right",
      h2("Build your model"),
        label = "Select any of the independent variables below to calculate your model. You can change your selection at any time.",
          "ACEs" = "ACEs"),
        selected = "Risk"
                type = "tabs",
                  "Regression Table",
                  h3("Table of Regression Coefficients"),
                  helpText("Describe the model")

shinyApp(ui = ui, server = server)

Hi! It seems the problem is coming from yout call to svyglm(), specifically from the object you are passing as an argument.

Were you able to fit this model outside your shiny app successfully?

In any case, I would take a look at the reference for the svyglm() function. It seems the arguments that you are passing might be off.

This post was published by an Appsilon team member. Our company can help you get the most out of RShiny and Posit/RStudio products.

Check our open positions here.

Appsilon: Building impactful RShiny Dashboards and providing R coding services.

Aww Thank you Agus for mentioning, I figured it out. I used the function lm instead and it worked ! Thank you so much for your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.