R markdown:将html表格下载到excel文件

Jua*_*rer 5 html markdown r r-markdown kable

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

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

小智 7

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

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

  • 我只有一个 CSV 按钮,单击它时没有任何反应。 (2认同)