如何解决表格输出出现问题
这是我的数据集
我想用flextable对Shiny中的产品进行过滤,并得到这样的东西:
这是我的代码:
library(shiny)
my_data = data.frame(product = rep(c("auto","boat"),each=2),year = c("2009","2011","2005","2019"),price = c("10 000","20 000","7 000","60 000"),speed = c("220","250","70","140"))
ui <- fluidPage(
selectInput("product","",choices = my_data$product),tableOutput("tbl")
)
server <- function(input,output,session) {
output$tbl <- renderTable( {
out <- subset(my_data,product ==input$product)
library(flextable)
flextable(out) # i got error
})
}
shinyApp(ui,server)
但是我遇到了这个错误:无法将“ flextable”类强制转换为data.frame
我们该如何解决?一些帮助将不胜感激
解决方法
您不能将function onEdit(e) {
if (e.range.getSheet().getName() == "A") {
function1();
}
else if (e.range.getSheet().getName() == "B") {
function2();
}
else {
function3();
}
}
function function1(){
Logger.log("The sheet name is A");
}
function function2(){
Logger.log("The sheet name is B");
}
function function3(){
Logger.log("The sheet name is different");
}
与renderTable
对象一起使用。参见flextable
:
expr:该表达式返回一个R对象,该对象可以与 xtable :: xtable()。
Here,您可以找到有关如何在闪亮的应用程序中使用?renderTable
的教程。
请检查以下内容:
flextable
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。