I missed this one. The following should work:
library(kableExtra)
dt <- data.frame(stringsAsFactors = FALSE,
c("A", "A", "B", "B", "C", "C"),
c(74, 52, 49, 68, 97, 23),
c(36, 60, 24, 36, 75, 29),
c(20, 16, 39, 98, 6, 64),
c(43, 84, 3, 57, 35, 9),
c(75, 36, 20, 70, 60, 37),
c(31, 7, 40, 81, 65, 74))
names(x = dt) <- c("ProductID", "M", "F", "M", "F", "M", "F")
dt %>%
kable() %>%
kable_styling(bootstrap_options = "bordered",
full_width = FALSE) %>%
add_header_above(header = c("", "Apple" = 2, "Orange" = 2, "Grapes" = 2),
bold = TRUE) %>%
collapse_rows(columns = 1,
valign = "middle") %>%
row_spec(row = 0,
bold = TRUE)
Yes, I know and specified in my previous post. I don't know how to do it.
I don't follow this one.
I guess you wanted these as bullets. You need to add a space after *. I edited your post, and I hope you won't mind.
I'll suggest you to avoid name mentioning as far as possible. Please take a look here: