表格输出出现问题

问题描述

这是我的数据集

enter image description here

我想用flextable对Shiny中的产品进行过滤,并得到这样的东西:

enter image description here

这是我的代码:

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

我们该如何解决?一些帮助将不胜感激

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)