这是我的数据集
\n\n我想用 flextable 过滤 Shiny 中的产品并得到这样的结果:
\n\n这是我的代码:
\nlibrary(shiny)\n\nmy_data = data.frame(product = rep(c("auto", "boat"),each=2),\n year = c("2009", "2011", "2005", "2019"),\n price = c("10 000", "20 000", "7 000", "60 000"),\n speed = c("220", "250", "70", "140"))\n\n\nui <- fluidPage(\n selectInput("product", "", choices = my_data$product),\n tableOutput("tbl")\n)\n\nserver <- function(input, output, session) {\n output$tbl <- renderTable( {\n out <- subset(my_data, product ==input$product)\n library(flextable)\n flextable(out) # i got error\n })\n}\n\nshinyApp(ui, server)\nRun Code Online (Sandbox Code Playgroud)\n但我收到此错误:无法将类 \xe2\x80\x98"flextable"\xe2\x80\x99 强制到 data.frame
\n我们该如何解决它?一些帮助将不胜感激
\n