Search notes:

R function: prop.table

options("digits"=2)

m <- matrix (
       c(  1, 3, 1,
           7, 3, 5),
       ncol  = 3,
       byrow = TRUE
)

prop.table(m)
#      [,1] [,2] [,3]
# [1,] 0.05 0.15 0.05
# [2,] 0.35 0.15 0.25

prop.table(m, 1)
#      [,1] [,2] [,3]
# [1,] 0.20  0.6 0.20
# [2,] 0.47  0.2 0.33

prop.table(m, 2)
#      [,1] [,2] [,3]
# [1,] 0.12  0.5 0.17
# [2,] 0.88  0.5 0.83
Github repository about-r, path: /functions/prop.table.R

See also

Index to (some) R functions

Index