pctab {Epi} | R Documentation |
Computes percentages and a margin of totals along a given margin of a table.
pctab(TT, margin = length(dim(TT)))
TT |
A table or array object |
margin |
Which margin should be the the total? |
A table, where all dimensions except the one specified margin
has two extra levels named "All" (where all entries are 100) and "N".
Bendix Carstensen, Steno Diabtes Center, http://www.biostat.ku.dk/~bxc
Aye <- sample( c("Yes","Si","Oui"), 177, replace=TRUE ) Bee <- sample( c("Hum","Buzz"), 177, replace=TRUE ) Sea <- sample( c("White","Black","Red","Dead"), 177, replace=TRUE ) A <- table( Aye, Bee, Sea ) A ftable( pctab( A ) ) ftable( pctab( addmargins( A, 1 ), 3 ) ) round( ftable( pctab( addmargins( A, 1 ), 3 ), row.vars=3 ), 1)