I am trying to add a header above the table.
the objective is to add header above column name "#" and also I want to convert the table in flex table to apply flextable themes.
also i want to group the table on the basis of car type . any solution for that
df <- data.frame(names= c("Mazda RX4", "Mazda RX4 Wag", "Datsun 710", "Hornet 4 Drive", "Hornet Sportabout", "Valiant", "Duster 360", "Merc 240D", "Merc 230", "Merc 280", "Merc 280C", "Merc 450SE", "Merc 450SL", "Merc 450SLC", "Cadillac Fleetwood"),
score = c(21, 21, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4) )
table1 <- df %>% rownames_to_column("#") %>% rename("Car type" = names) %>%
mutate(score = as.character(score)) %>%
add_row(`Car type` = "", score = "form", .before = "#")