我正在绘制一个表格,如下图所示。有没有办法拯救它?我不能只是导出它,因为它只导出部分图像。
test1 %>%
group_by(Name) %>%
summarise("Weekly_trend" = spk_chr(Total)) %>%
left_join(data) %>%
formattable() %>%
as.datatable() %>%
spk_add_deps()发布于 2021-11-19 23:24:07
因为我回答了你的上一个问题,所以我有更多的背景知识。由于某些原因,您创建的表似乎不想使用所提到的above方法导出。
但是,您可以使用以下代码导出表并将其另存为图像。首先,表被保存为htmlwidget。如果需要,您可以打开输出.html文件并查看该表。webshot然后将拍摄表格的照片并将其另存为图像。
library(htmlwidgets)
library(webshot)
test1 %>%
group_by(Name) %>%
summarise("Weekly_trend" = spk_chr(Total)) %>%
formattable() %>%
as.datatable(options = list(pageLength = 30)) %>%
spk_add_deps() -> w
htmlwidgets::saveWidget(w, "table.html", selfcontained = TRUE)
webshot::webshot(url = "table.html", file = "table.png",
vwidth = 1000, vheight = 275)https://stackoverflow.com/questions/70041596
复制相似问题