Description Usage Arguments Examples
Create a table similar to the base
R
function
table
, but instead with formatted column
names and as a data.table
so that it can easily be
manipulated or put into an analysis.
1 | formatted_table(x, ..., var_names = NULL, cross_symbol = " X ")
|
x |
a |
... |
one or two columns to use to calculate a simple table, or cross table. Enter the names unquoted. |
var_names |
custom variable names may be specified and will be used
in the table title. Default |
cross_symbol |
symbol to use in the table title to signify the cross of two variables. Default is " X ". |
1 2 3 4 5 6 7 8 9 10 11 | # Create a cross table of cyl and vs
formatted_table(mtcars, cyl, vs)
# Add custom names using the var_names parameter
formatted_table(mtcars, cyl, vs, var_names = c("Cylinders", "Engine"))
# Add a custom by option
formatted_table(mtcars, cyl, vs, cross_symbol = " by ")
# Allows for functions to be used directly as variable inputs.
formatted_table(mtcars, cyl > 6, vs, var_names = c("cyl > 6", "vs"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.