For each row group of a share table (from PlotDataCrossShares()), finds
the category with the largest share (ties go to the earlier category in
columns) and orders the groups by the position of that category in
priority, then by the group value. Categories missing from priority
take position zero, before all listed ones. A group without any share
among columns has a missing dominant category and also takes position
zero.
See also
Other plot-data builders:
PlotDataBindRows(),
PlotDataConstant(),
PlotDataCount(),
PlotDataCrossShares(),
PlotDataDirection(),
PlotDataFromArrays(),
PlotDataJoin(),
PlotDataKeyColours(),
PlotDataLabels(),
PlotDataLonger(),
PlotDataMembership(),
PlotDataPairRatio(),
PlotDataProduct(),
PlotDataQuantiles(),
PlotDataRankRows(),
PlotDataRatio(),
PlotDataRecode(),
PlotDataRelative(),
PlotDataSelect(),
PlotDataShares(),
PlotDataSummarise(),
PlotDataUnite()
Examples
s <- PlotDataCrossShares(data.frame(cl = c(1, 1, 2, 3), type = c("b", "b", "a", "b")), "cl", "type")
PlotDataDominant(s, "cl", "type", "share", columns = c("a", "b"), priority = c("a", "b"))
#> cl dominant dominant_share rank
#> 1 2 a 100 1
#> 2 1 b 100 2
#> 3 3 b 100 3