I have a list of University's sorted by rank:
rank uni data
1 Stanford University 1
1 Stanford University 5
1 Stanford University 3
2 Yale University 2
3 University of Pennsylvania 8
I want to group by uni, and aggregate the data. When there's multiple rows for the same uni, the aggregated value is shown at the top and you can expand it to show the individual rows.
I want to exclude rank from the "groupBy" process. I want to always see rank on the left, in the first column, and when expanding a uni, subsequent individual rows of rank are empty. With the following code, rank is only visible when a uni is expanded:
reactable(
df,
groupBy = "University",
columns = list(
rank = colDef(align = "center"),
uni= colDef(name = "Psychology School"),
value = colDef(aggregate = "mean")))
I can aggregate the rank column by unique values, but then when unis are expanded, the rank column just repeats the rank for each row and it looks a mess:
reactable(
df,
groupBy = "University",
columns = list(
rank = colDef(aggregate = "unique", align = "center"),
uni= colDef(name = "Psychology School"),
value = colDef(aggregate = "mean")))
Can anyone offer any suggestions? Many thanks!