R 术语错误。公式(对象,数据=数据):在应用程序中

R 术语错误。公式(对象,数据=数据):在应用程序中,r,shiny-server,shiny,R,Shiny Server,Shiny,我在一个有光泽的线性回归应用程序中工作,我遇到了一些麻烦。 第一部分应该是瑞士数据集的一个例子。以下是ui部分: checkboxInput(inputId="example", label= "Let's see an example?", value=FALSE), conditionalPanel("input.example", selectInput(inputId="swis

我在一个有光泽的线性回归应用程序中工作,我遇到了一些麻烦。 第一部分应该是瑞士数据集的一个例子。以下是ui部分:

  checkboxInput(inputId="example",
                label= "Let's see an example?",
                value=FALSE),
  conditionalPanel("input.example",
                   selectInput(inputId="swissy",
              label="Choose an response variable.",
              choices=names(swiss),
              selected=""),
  checkboxGroupInput(inputId="swissx",
                     label="Choose the explanatory variables.",
                     choices=names(swiss))
  ),
和服务器部分:

   observe({
    if(input$example){
      swissdata <- reactive({
      ys <- swiss[,input$swissy]
      xs <- model.matrix(~., swiss[,input$swissx])
      ms <- lm(ys~xs)
      return(ms)
      })
      output$table <- renderDataTable({swiss})
      output$model <- renderPrint({
        m0 <- swissdata()$ms
        print(summary(m0))
      })
      output$anova <- renderPrint({
        print(summary(anova(lm(swissdata()$ms))))
      })
      output$plots <- renderPlot({
        par(mfrow=c(2,2)); plot(lm(swissdata()$ms))
        ; layout(1)
      }, width=600, height=600)
    }
})
观察({
if(输入$example){

swissdata能否使上述代码可复制?能否使上述代码可复制?