How to do `group_by` + `rename` at the same time

TIL (technically, it’s not today. But I found this in my notes last semester, and I think it’s worth sharing):

output$tbl2 <- renderDT(
    hwm %>%
        State = stateName,
        Type = hwm_environment) %>%

This is a very useful trick. It’s a bit like dplyr::rename, but it’s more flexible. You can use it to rename columns, while grouping by one or more columns.

#r #snippet