I am interested in using tools within the formattable
R package, but I want to only shows in the table where there is a change. That is, I want hierarchical row labeling that is offered in the kableExtra
package via the collapse_rows()
function.
For example, using kable()
and kableExtra
, I can do this:
library(dplyr)
library(knitr)
library(kableExtra)
iris %>%
group_by(Species) %>%
slice(1:2) %>%
select(Species, everything()) %>%
kable() %>%
collapse_rows(1, valign="top")
to produce this:
However, I would like to do this using the formattable
package and function so that I can run an arbitrary function over specific colums during output. Specifically, I want to add "sparklines" as a new column. I can do that using knitr
and formattble
, but then I lose the collapse_rows
, as far as I can tell.
Is there any way to collapse rows in formattable
?