【问题标题】:R markdown: download a html table to an excel fileR markdown:将html表格下载到excel文件
【发布时间】:2019-05-12 16:36:38
【问题描述】:

我有一个 R 降价,我在其中构建了一个表格,我想添加将表格下载到 Excel 文件的选项。

kable(MyTable) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", 
  "responsive")) %>%
  scroll_box(width = "900px", height = "500px")

【问题讨论】:

  • 您的问题不是关于knitrkableExtra,而是关于shiny 和处理文件下载。看看shiny::downloadHandler
  • 重点是我们不想使用闪亮的应用,而是使用 r markdown html

标签: html r markdown r-markdown kable


【解决方案1】:

您总是可以尝试使用DT::datatable 来获取导出按钮

MyTable %>%
  DT::datatable(
    extensions = 'Buttons', 
    options = list(dom = 'Bfrtip', 
                   buttons = c('excel', "csv")))

【讨论】:

  • 小备注,指定应该显示哪些按钮似乎需要一个列表,而不是一个向量:..., buttons = list("excel", "csv")
  • 我只有一个 CSV 按钮,当我点击它时没有任何反应。
猜你喜欢
  • 2014-04-08
  • 2017-07-14
  • 1970-01-01
  • 1970-01-01
  • 2015-07-18
  • 2022-01-24
  • 1970-01-01
  • 2014-10-01
  • 1970-01-01
相关资源
最近更新 更多