Create Shiny table that groups rows into one row

I have a Shiny app in which I'm trying to group rows with the same label in the "player" column of a data frame so that the first cell is essentially merged into one with the rest to follow. Below is how I'm hoping it will look (using Excel to demonstrate):

Is that possible to do in Shiny either with reactable (what I'm currently using) or just a regular shiny datatable? Below is the code I've already set up for the app as a minimal reprex:

players <- c('Aaron Rodgers', 'Aaron Rodgers', 'Patrick Mahomes', 'Patrick Mahomes', 'Josh Allen', 'Josh Allen')
sides <- c('over', 'under', 'over', 'under', 'over', 'under')
dk <- c(-115, 110, 110, -115, 100, 100)
fd <- c(-115, 110, 110, -115, 100, 100)
pb <- c(100, 100, 100, 100, 100, 100)

df <- data.frame(players, sides, dk, fd, pb)


ui <- fluidPage(

    titlePanel("Test App"),

server <- function(input, output) {

    output$table <- renderReactable({

shinyApp(ui = ui, server = server)

Not quite what you are after, but you could use the grouping and aggregation in reactable?

Have a loot at the Flextable package. You are looking for the merge_v function.

This looks like it will work. Thanks, @noveld!

This topic was automatically closed 54 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.