R - prop.table(): compute proportion table

26 Aug 2017

equivalent to sweep(x, margin, margin.table(x, margin), "/") except that it returns gets x/sum(x) if margin has length zero

m <- matrix(1:4, 2)
prop.table(m, 1)

viewed on http//www.rfunction.com

[ R  function  matrix  ]