在使用观察者观察创建用于下载的CSV文件的操作的过程中,我遇到了挑战。我认为R-Studio文档指出eventExpr可能是“花括号内的复杂表达式”。这是有效的eventExpression吗?我使用这个构造5次,当我的shinyApp启动时,所有5个条件都会被触发。
observeEvent(
{
### Observe the download handler preparing for CSV download
output$Wire_Centers.csv <- downloadHandler(
filename = "Wire_Centers.csv",
content = function(file) {
write.table(WC_List_2(), file, row.names=FALSE, col.names = TRUE, sep=',') ### end write.table
} # End content function
) # End downloadHandler
}, { # End observered event, start log
logUse("WC_Download")
}) # end observeEvent output condition
有什么想法或建议吗?
发布于 2018-06-11 08:30:48
我通过添加日志函数调用作为downloadHandler的content函数的第一个子句来完成添加活动日志操作。call logUse("WC_Download")
会按要求运行,活动日志也会相应增加。
output$Wire_Centers.csv <- downloadHandler(
filename = "Wire_Centers.csv",
content = function(file) {
logUse("WC_Download")
write.table(WC_List_2(), file, row.names=FALSE, col.names = TRUE, sep=',') ### end write.table
}, # End content function
) # End downloadHandler
https://stackoverflow.com/questions/50766647
复制相似问题