Hello. I am trying to make a table in gt with this data:
ab <- data.frame(
stringsAsFactors = FALSE,
Country = c("Germany", "Australia", "Ireland", "France", "Denmark"),
Operations = c(3L, 1L, 2L, 1L, 1L),
Euros = c(79545479, 3530267, 56855826, 7759, 1230071),
Tons = c(1230497, 48, 57704, 228, 249)
I use this code:
ab %>%
gt() %>%
fmt_number(columns = 3:4, decimals = 2, sep_mark = ".", dec_mark = ",") %>%
gt_highlight_rows(rows = c(1,2), font_weight = "bold") %>%
gt_highlight_rows(rows = c(3,4), font_weight = "bold", fill = "lightblue") %>%
grand_summary_rows(columns = c(Operations, Euros, Tons),
fns = list(Total = "sum")) %>%
gt_theme_nytimes()
I obtain this:
How can I move the total to below the Country column and remove the extra column in the left? And format the text in the same style as the rest of the table?
Thanks all.