[英]Error in match(el, set, 0L) : 'match' requires vector arguments?
In running the following code in Shiny in R :在 R 中的 Shiny 中运行以下代码:
client_report_type = reactive({ input$report_type })
if ( is.element(client_report_type,"Enterprise_user"))
...
I encountered the following error message:我遇到以下错误消息:
Error in match(el, set, 0L) : 'match' requires vector arguments
Does anyone know what does it mean, and how to resolve the problem?有谁知道这是什么意思,以及如何解决这个问题? Thanks!
谢谢!
You don't need to put an input inside a reactive to get the value, but the input should be inside of a reactive expression.您不需要将输入放在反应式中以获取值,但输入应该在反应式表达式中。 Anything outside a reactive expression will be execute only once when the shiny app starts.
当闪亮的应用程序启动时,反应表达式之外的任何内容都只会执行一次。 And if you try to use an
input
value outside a reactive expression there will be an error.如果您尝试在反应式表达式之外使用
input
值,则会出现错误。 Depending of what you are going to do with input$report_type
you can put it in a reactive
(of course), observe
, or observeEvent
.根据您要对
input$report_type
执行的操作,您可以将其放入reactive
(当然)、 observe
或observeEvent
中。
Here are some basic examples:以下是一些基本示例:
reactive:反应式:
dat <- reactive({
if ( is.element(input$report_type,"Enterprise_user")) {
...
myData
} else {
NULL
}
})
observe:观察:
observe({
if (is.null(input$report_type))
return()
if ( is.element(input$report_type,"Enterprise_user"))
...
})
observeEvent:观察事件:
observeEvent(input$report_type, {
if ( is.element(input$report_type,"Enterprise_user"))
...
})
Here is great tutorial about shiny and reactivity: http://deanattali.com/blog/building-shiny-apps-tutorial/#reactivity-101这是关于闪亮和反应性的很棒的教程:http: //deanattali.com/blog/building-shiny-apps-tutorial/#reactivity-101
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.