ds_cross_table {descriptr} | R Documentation |
Two way table
Description
Creates two way tables of categorical variables. The tables created can be visualized as bar plots and mosaic plots.
Usage
ds_cross_table(data, var_1, var_2)
## S3 method for class 'ds_cross_table'
plot(x, stacked = FALSE, proportional = FALSE, print_plot = TRUE, ...)
ds_twoway_table(data, var_1, var_2)
Arguments
data |
A |
var_1 |
First categorical variable. |
var_2 |
Second categorical variable. |
x |
An object of class |
stacked |
If |
proportional |
If |
print_plot |
logical; if |
... |
Further arguments to be passed to or from methods. |
Examples
# cross table
k <- ds_cross_table(mtcarz, cyl, gear)
k
# bar plot
plot(k)
# stacked bar plot
plot(k, stacked = TRUE)
# proportional bar plot
plot(k, proportional = TRUE)
# returns tibble
ds_twoway_table(mtcarz, cyl, gear)
[Package descriptr version 0.6.0 Index]