tabit_x {tabit} | R Documentation |
tabit_x
Description
Function for cross tabulation of variables within a data.frame or data.frame like.
Usage
tabit_x(x, ..., sort = 1, digits = 2, useNA = TRUE)
## S3 method for class 'data.frame'
tabit_x(x, ..., sort = 1, digits = 2, useNA = TRUE)
## S3 method for class 'grouped_df'
tabit_x(x, ..., sort = 1, digits = 2, useNA = TRUE)
## Default S3 method:
tabit_x(x, ..., sort = 1, digits = 2, useNA = "always")
Arguments
x |
the thing to be tabulated |
... |
further optional arguments passed through to methods |
sort |
should |
digits |
the number of digits to round percentages to |
useNA |
whether ro us NAs as value category or not, defaults to TRUE |
Details
The data.frame method will take all column value combination for cross tabulation while the grouped_df method is explicitly for tibbles with group information. For those only value combinations for the group columns are relevant.
Value
Returns a data frame with columns
zero, one or more columns with value combinations to be cross tabulated by,
.count
(the number of times a value occurred),
.pct
(the percentage that value occurred excluding NAs) and
.pct_incl_na
(the percentage that value occurred including NAs)
Examples
tabit_x(mtcars)
tabit_x(mtcars[, c("cyl", "am")])