powered by
Return the row percentages of a two-way frequency table with formatting and printing options.
rprop(tab, ...)# S3 method for table rprop( tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ... )# S3 method for data.frame rprop( tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ... )# S3 method for matrix rprop( tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ... )# S3 method for tabyl rprop(tab, digits = 1, total = TRUE, percent = FALSE, n = FALSE, ...)
# S3 method for table rprop( tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ... )
# S3 method for data.frame rprop( tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ... )
# S3 method for matrix rprop( tab, digits = 1, total = TRUE, percent = FALSE, drop = TRUE, n = FALSE, ... )
# S3 method for tabyl rprop(tab, digits = 1, total = TRUE, percent = FALSE, n = FALSE, ...)
The result is an object of class table and proptab.
table
proptab
frequency table
parameters passed to other methods.
number of digits to display
if TRUE, add a column with the sum of percentages and a row with global percentages
TRUE
if TRUE, add a percent sign after the values when printing
if TRUE, lines or columns with a sum of zero, which would generate NaN percentages, are dropped.
NaN
if TRUE, display number of observations per row.
cprop, prop, table, prop.table
cprop
prop
prop.table
## Sample table data(Titanic) tab <- apply(Titanic, c(1,4), sum) ## Column percentages rprop(tab) ## Column percentages with custom display rprop(tab, digits=2, percent=TRUE, total=FALSE)
Run the code above in your browser using DataLab