I'm trying to create a table in R Markdown/Kable where rows 2, 5, 8, 11, 14 have the same name ("Tattooed") and 3, 6, 9, 12, 15 have the same name ("Prominently Tattooed"). Is there any way to do this?
As you can see in the screenshot, I am currently using a workaround with brackets. But I would like to get rid of them.
Renaming in the data frame doesn't work because the names are duplicated.
table_anova_posthoc <- data.frame(
matrix(
nrow = 18, ncol = 8)
)
rownames(table_anova_posthoc) <- c("Trust", "Tattooed", "Prominently Tattooed", "Responsibility", "Tattooed", "Prominently Tattooed", "Negative Emotionality", "Tattooed", "Prominently Tattooed", "Depression", "Tattooed", "Prominently Tattooed", "Emotional Volatility", "Tattooed", "Prominently Tattooed", "Self-Esteem", "Tattooed", "Prominently Tattooed")
Error when knitting:
Quitting from lines 1593-1799 [unnamed-chunk-5] (Master-Thesis.Rmd)
Error in `.rowNamesDF<-`:
! duplicate 'row.names' are not allowed
Backtrace:
1. base::`rownames<-`(`*tmp*`, value = `<chr>`)
3. base::`row.names<-.data.frame`(`*tmp*`, value = value)
4. base::`.rowNamesDF<-`(x, value = value)
Execution halted
My workaround with brackets:
rownames(table_anova_posthoc) <- c("Trust", "Tattooed (T)", "Prominently Tattooed (T)", "Responsibility", "Tattooed (R)", "Prominently Tattooed (R)", "Negative Emotionality", "Tattooed (NE)", "Prominently Tattooed (NE)", "Depression", "Tattooed (D)", "Prominently Tattooed (D)", "Emotional Volatility", "Tattooed (EV)", "Prominently Tattooed (EV)", "Self-Esteem", "Tattooed (SE)", "Prominently Tattooed (SE)")