Goal
I would like to produce row aggregates for a table grouped by the rowGroup
extension to the DT
library. I am able to group the data frame with rowGroup
but am unclear how to populate aggregated values in the summary rows.
What I’ve tried
Consulting examples in the DT documentation, here and here I believe the answer lies in using rowGroup.startRender
. However, I am unclear how to implement this in the R DT
library rowGroup
extension.
Desired Output
I would like to get the number of samples per group as well as the average weight by group.
Code
DT::datatable(chickwts,
rownames = TRUE,
extensions="RowGroup",
options = list(rowGroup = list(dataSrc=c(2),
columnDefs = list(list(visible=FALSE, targets=c(2))))
))