![](/img/trans.png)
[英]How to change output for N/A on tables using formattable package in R
[英]Merge tables in formattable in R
有沒有辦法在 R 中以 formatttable 格式組合這兩個表? 我想保留最終表格數據中的迷你圖:
test1<-structure(list(Name = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L), .Label = c("John", "Mary"), class = "factor"),
year = c(2021L, 2021L, 2021L, 2021L, 2021L, 2021L, 2021L,
2021L, 2021L, 2021L, 2021L, 2021L), week = c(1L, 2L, 3L,
4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L), Total = c(3L, 2L, 0L,
0L, 1L, 0L, 3L, 2L, 0L, 0L, 1L, 0L)), class = "data.frame", row.names = c(NA,
-12L))
data <- structure(list(Name = structure(2:1, .Label = c("John", "Mary"
), class = "factor"), Total_per_name = c(50L, 100L)), class = "data.frame", row.names = c(NA,
-2L))
My code
test1 %>%
group_by(Name) %>%
summarise("Weekly_trend" = spk_chr(Total)) %>%
formattable() %>%
as.datatable() %>%
spk_add_deps()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.