Skip to contents

Convenience wrappers around apply() to compute row and column percentages of matrix-like structures, including output of xtabs.

Usage

col.perc(x)

row.perc(x)

Arguments

x

matrix-like structure

Author

Randall Pruim

Examples


row.perc(tally(~ airline + result, data = AirlineArrival))
#>              result
#> airline         Delayed    OnTime
#>   Alaska      0.1327152 0.8672848
#>   AmericaWest 0.1089273 0.8910727
col.perc(tally(~ airline + result, data = AirlineArrival))
#>              result
#> airline         Delayed    OnTime
#>   Alaska      0.3889752 0.3371087
#>   AmericaWest 0.6110248 0.6628913