| cprop {questionr} | R Documentation |
Return the column percentages of a two-way frequency table with formatting and printing options.
cprop(tab, ...) ## S3 method for class 'table' cprop(tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ...) ## S3 method for class 'data.frame' cprop(tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ...) ## S3 method for class 'matrix' cprop(tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ...) ## S3 method for class 'tabyl' cprop(tab, digits = 1, total = TRUE, percent = FALSE, n = FALSE, ...)
tab |
frequency table |
... |
parameters passed to other methods. |
digits |
number of digits to display |
total |
if |
percent |
if |
drop |
if |
n |
if |
The result is an object of class table and proptab.
rprop, prop, table, prop.table
## Sample table data(Titanic) tab <- apply(Titanic, c(4,1), sum) ## Column percentages cprop(tab) ## Column percentages with custom display cprop(tab, digits=2, percent=TRUE, total=FALSE)