简体   繁体   English

R:In Shiny如何修复应用于“反应性”类对象的“xtable”的适用方法

[英]R: In Shiny how do I fix no applicable method for 'xtable' applied to an object of class “reactive”

I'm getting this error: 我收到这个错误:

Error in UseMethod("xtable") : 
  no applicable method for 'xtable' applied to an object of class "reactive"

UI.R UI.R

library(shiny)
shinyUI(pageWithSidebar(
  headerPanel("Test App"),
  sidebarPanel(
    textInput(inputId="text1", 
              label = "Enter Keywords"),
    actionButton("goButton", label = "Go!", icon = "search")
  ),
  mainPanel(
    p('Your search:'),
    textOutput('text1'),
    p(''),
    textOutput('text3'),
    p('Search Results'),
    tableOutput('searchResult')
  )
))

Server.R Server.R

library(shiny)

data <- read.csv("./data/data.csv", quote = "")

shinyServer(
  function(input, output) {
    searchResult<- reactive({
      subset(asos, grepl(input$text1, asos$Title))
    })

    output$text1 <- renderText({input$text1})
    output$text3 <- renderText({      
      if (input$goButton == 0) "Get your search on!"
      else if (input$goButton == 1) "Computing... here's what I found!"
      else "OK, I updated the results!"
    })
    output$searchResult <- renderTable({ 
      searchResult
    })
  }
)

reactive returns a function. reactive返回一个函数。 To call the reactive function you would use: 要调用反应函数,您将使用:

output$searchResult <- renderTable({ 
  searchResult()
})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复适用于 Shiny 中类“NULL”错误的对象的“tbl_vars”没有适用的方法 - how to fix no applicable method for 'tbl_vars' applied to an object of class “NULL” error in Shiny R闪亮-错误“没​​有适用于&#39;ggplotly&#39;的适用方法应用于类&#39;c(&#39;double&#39;,&#39;numeric&#39;)的对象” - R Shiny - Error “no applicable method for 'ggplotly' applied to an object of class ”c('double', 'numeric')” R闪亮过滤器没有适用于“filter_”的方法应用于“函数”类的对象 - R shiny filter no applicable method for 'filter_' applied to an object of class "function" 如何使用slackr修复此错误:UseMethod(“ tbl_vars”)中的错误:没有适用于“ tbl_vars”的适用方法应用于类“ NULL”的对象 - How can I fix this error with slackr: Error in UseMethod(“tbl_vars”) : no applicable method for 'tbl_vars' applied to an object of class “NULL” R-Project没有适用于“元”类对象的“元”适用方法 - R-Project no applicable method for 'meta' applied to an object of class “character” R中的错误:没有适用于“预测”的适用方法应用于“ NULL”类的对象 - Error in R: no applicable method for 'predict' applied to an object of class “NULL” R中的错误-没有适用于“预测”类别的对象的“预测”方法 - Error in R - no applicable method for 'predict' applied to an object of class “formula” R函数错误,“对“ NULL”类的对象没有适用的“预测”适用方法 - R function error, “no applicable method for 'predict' applied to an object of class ”NULL" 没有适用于“ ggplotly”的适用于“ NULL”类对象的方法 - no applicable method for 'ggplotly' applied to an object of class “NULL” 没有适用于“准备”的方法应用于类对象 - no applicable method for 'prep' applied to an object of class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM