I am unsure if I am doing anything wrong, but I am trying to create a table with a header that groups columns like below:
I followed the instructions provided in the documentation here, but I am still getting lines on the header cells that should be blank (first 2 columns). Below is the table I get after knitting to an html file. I am unsure how to troubleshoot.
Here is my reproducible table:
structure(list(sigma = c(0.321, 0.554, 0.483, 5.684, 8.824, 5.25
), R2 = c(94.47, 83.074, 86.853, 1.088, 13.921, 44.549), Linearity = c(8.38493902175155,
7.74415836463606, 7.83262748829169, 3.58505816475888, 21.3428889807196,
28.3052628262925), XLinearity = c(3.63637661675805, 3.35848314705469,
3.39685039716013, 0.307760165986819, 1.83218535194569, 2.42987198125591
), Appraiser = c("AA", "AB", "AC", "AA", "AB", "AC"), Signal = c("Frequency",
"Frequency", "Frequency", "Amplitude", "Amplitude", "Amplitude"
)), row.names = c(NA, 6L), class = "data.frame")
And my attempt:
GageResults$GageBiasAll%>%
`colnames<-`(c("Value",rep(c("Bias","%Bias","$p$-value"),3)))%>%
cbind(Signal=c(rep("Frequency",6),rep("Amplitude",6)),.)%>%
kable(#caption = "Variation or each source of measurement error",
booktabs=T,row.names = F,
escape = T,digits = 3
)%>%
# pack_rows("Frequency", 1, 6) %>%
# pack_rows("Amplitude", 7, 12)%>%
kable_styling(latex_options = c("striped","hold_position"))%>%
collapse_rows(columns = 1, valign = "middle")%>%
kable_classic(full_width = T, html_font = "Helvetica")%>%
add_header_above(c(" "=2, "AA" = 3, "AB" = 3,"AC"=3))
And the result produced in the html file after knitting the markdown file. Again, I am trying to get rid with the line below the spaces that should be blank.
Thank you so much for the help!