To create subheaders and headers with repeating value columns using kableExtra in R, you can use the following approach:
First, install and load the necessary packages:
main.r78 chars4 lines
Create a sample data frame:
main.r181 chars7 lines
Use kable and kable_styling from kableExtra to create a table with subheaders and headers:
main.r308 chars8 lines
However, to make the headers repeat for every category, you need to reshape your data and add the headers manually. Here's how you can do it:
main.r823 chars31 lines
Note that this will require you to rearrange your data and might not work perfectly for every scenario. However, it should give you an idea of how to approach the problem.
You can adjust the style and format as needed to fit your requirements. Also, you can create more complex tables with different types of headers and subheaders.
Always make sure to check the kableExtra documentation for the most up-to-date information on its functionality.
Tags: r, kableExtra, data.table, dplyr.
gistlibby LogSnag