kableExtra::collapse_rows provides a nice way to create tables with collapsed (or merged) cells by row. I was wondering if kableExtra also provides a method to collapse cells by column. For instance, in the example below, I would like to merge the b's in the 2nd row of my table.
If this functionality is not available in kableExtra, are you aware of a package that provides the ability to:
Just wanna chime in and say that I am also looking for the possibility to merge rows in kable tables. I tried looking at the code for the collapse_rows function to try and adapt it to columns. I suspect that there should be a way of inserting the colspan HTML argument instead of rowspan, which the collapse_row function uses. However, I am not proficient enough in HTML nor in the nitty gritty details of function creation in R to actually modify the original function to suit my needs.
I found that the flextable package provides functionality to merge cells by row and/ column. However, it seems to lack latex reporting functionality, which I need. Anyways, depending on your requirements, flextable might be an option for you.
Thanks for the advice! I'll look into the flextable package. Maybe I can try and adapt the row merge function from that package to my kableextra workflow...
Thanks for the advice again @pomchip! I've considered huxtable before but I have a problem finding that one R package that can do all the things I need to make nice formatted tables. I'm testing a bunch packages of packages to find the right one. I haven't gotten to huxtable yet but I'll be sure to give it a try!
I considered using gt, but, IMO, huxtable currently provides more functionality than gt (in particular the range of possible outputs and the merging capabilities within the table itself).