| percTable {NCStats} | R Documentation |
Same as prop.table() except that it returns
percentages rather than proportions.
percTable(x, margin = NULL, digits = getOption("digits"),
addMargins = TRUE)
x |
A frequency table likely constructed with table(). |
margin |
A numeric representing an index, or vector
of indices, to generate the margin for – |
digits |
A numeric indicating the number of decimals to round the percentages to.. |
addMargins |
A logical indicating whether marginal
totals should be appended to the table or not. If
|
Same type as x except with percentages of a margin
rather than frequencies.
prop.table, addmargins, and
addMargins in FSA.
Aye <- sample(c("Yes", "Si", "Oui"), 177, replace = TRUE)
Bee <- sample(c("Hum", "Buzz"), 177, replace = TRUE)
( A <- table(Aye, Bee) )
## what prop.table() would look like
prop.table(A,margin=1)
## modified for percTable
# row percentages
percTable(A,margin=1)
percTable(A,margin=1,digits=1)
# column percentages
percTable(A,margin=2)
# table percentages
percTable(A)
## No marginal totals
percTable(A,addMargins=FALSE)