【发布时间】:2018-11-06 22:40:31
【问题描述】:
我有一组变量用作 html 元素上的 id,具有匹配的函数(方便地命名为 varname.helper()),每当在相应的 html 元素上触发事件时,我希望调用它们。
我尝试了以下方法:
server <- function(input, output, session) {
observables <- c("foo1", "foo2", "foo3") # they are obviously much more than 3 vars...
observables %>% walk(function(x) {
observeEvent(quo(!!sym(paste0("input$", x))), quo(!!sym(paste0(x, ".helper"))(input)), handler.quoted=TRUE)
}
但它没有用。有什么想法吗?
【问题讨论】:
-
您能否添加一个完整的应用程序作为您的最小(非)工作示例
-
关于以下答案争议的元问题:meta.stackoverflow.com/questions/368719/…