[英]Export table created in formattable in R
我正在繪制如下表。 有沒有辦法拯救它? 我不能只導出它,因為它只導出部分圖像。
test1 %>%
group_by(Name) %>%
summarise("Weekly_trend" = spk_chr(Total)) %>%
left_join(data) %>%
formattable() %>%
as.datatable() %>%
spk_add_deps()
自從我回答了你的最后一個問題以來,我有了更多的背景知識。 由於某種原因,您制作的表格似乎不想使用上述方法導出。
但是,您可以使用以下代碼導出表格並將其另存為圖像。 首先,表格被保存為 htmlwidget。 您可以打開獲取 output 的 output .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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.