小编Joh*_*ohn的帖子

Shiny 中的表输出出现问题

这是我的数据集

\n

在此输入图像描述

\n

我想用 flextable 过滤 Shiny 中的产品并得到这样的结果:

\n

在此输入图像描述

\n

这是我的代码:

\n
library(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)\n
Run Code Online (Sandbox Code Playgroud)\n

但我收到此错误:无法将类 \xe2\x80\x98"flextable"\xe2\x80\x99 强制到 data.frame

\n

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

\n

dashboard r flextable shiny

1
推荐指数
1
解决办法
602
查看次数

标签 统计

dashboard ×1

flextable ×1

r ×1

shiny ×1