Hi,
thank you very much for your reply and for the link, I will read "Welcome I R for Data Science" for sure.
To be honest I tried to remove "ans$DES_LIV05" column, but If I do it I cannot use
" pack_rows(index = table(ans$DES_LIV05)) ".
If the column is present in the data.frame it's printed twice :
- Grouped column (that's correct)
- Detail level (this is duplicate).
I did print the detail level DES_LIV05 value in white color and put it as last column as a workaround
column_spec(17, width = "5cm", color="white") .
I know it's very bad coding but I googled all day without finding a proper solution.
print(
kable(ans, "latex", booktabs = TRUE, longtable = TRUE, caption = i,
col.names = c("Descrizione",
"Articolo Nostro",
"Articolo Fornit",
"Ragione Sociale",
"Costo Netto",
"Fine Anno",
"Costo Netto Netto",
"Prezzo AC",
"Prezzo Ivato AC",
"Iva",
"UM",
"Qta Acq.",
"Qta Vend",
"Qta Rim.",
"% Marg. Netto",
"% Marg. Netto Netto",
".",
"ArtRaggr",
"."
) ) %>%
kable_paper("striped", full_width = F) %>%
kable_styling(latex_options = c("repeat_header"), font_size = 6) %>%
pack_rows(index = table(ans$DES_LIV05)) %>%
column_spec(1,width = "5.5cm") %>%
column_spec(2:2, width = "1cm",
background = ifelse(ans$CDARTRAGGR == ans$CDARTICOLO, "white", "green")) %>%
column_spec(3:3, width = "1cm") %>%
column_spec(4,width = "3.1cm") %>%
column_spec(5:14, width = "0.8cm") %>%
column_spec(15:16, width = "1.0cm") %>%
column_spec(17, width = "5cm", color="white")
)