Manually create an R Markdown table with cells spanning rows and columns?

I would like to manually create a table using R Markdown with cells spanning rows and columns. Let's use the Table of Error Types on Wikipedia for an example.

If existing documentation shows how to do this, I've failed to find it and would be happy with a link!

I believe the following link will be useful. Check the section Grouped Columns / Rows.

Or, are you specifically asking for Markdown way to construct this type of table?

I am pretty sure you can't do this in pure markdown but of course you can insert HTML. If you are producing PDF then you can insert LaTeX.

This is almost possible in gt. The thing that is missing is that the row groups need an option to span vertically in the stub (currently, they only span horizontally, across rows).

I'll create an issue in gt to track this.

Yarnabrina, I was asking for a way to do this just with Markdown, but that's not so important. Doing it with kableExtra would work out just as well and really it's more versatile and a more common use case. That said, the page you pointed to is very helpful. The grouped columns should do exactly what I need, and the grouped rows should work well enough, though they're rather unsatisfying. I think that that may just be a limitation I have to live with.

@jimbotyson, I thought of doing it with LaTeX, but would like to preserve the versatility of Markdown to be compiled to HTML and eBook. It's not often I miss LaTeX's flexibility, but this is one time I really do.

Please forgive my naivite, but what is gt?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.