I found an efficient way to make tables using kable and kableExtra. I can add line breaks too. I only have one issue with it, if I add a line break, the row color ends where the line break is. It's difficult to explain, so here is an image. As you can see, the color of the row should go to the very end, but it doesn't because of the line break. Do you know how I can fix this? Here is the code for this table:
library(knitr)
library(kableExtra)
name <- linebreak(c("Norman", "Gilda", "Wilma", "Wompa"))
animal <- linebreak(c("Hamster", "Flamingo", "Duck", "Wompa"))
food <- linebreak(c("Crumbs\nOther", "Pink lemonade", "Bread", "Tears of his enemies"))
animals <- data.frame(name, animal, food)
kable(animals, "pipe", caption="Example Table", col.name=linebreak(c("Name", "Animal", "Food")))