View source: R/aso_freq_function.R
freq_function | R Documentation |
A method for making 1- and 2-way frequency tables with percentages and odds ratios.
freq_function(
normaldata,
var1,
var2 = NULL,
by_vars = NULL,
include_NA = FALSE,
values_to_remove = NULL,
weightvar = NULL,
textvar = NULL,
number_decimals = 2,
output = c("all", "numeric", "col", "colw", "row", "roww", "total", "totalw"),
chisquare = FALSE
)
normaldata |
A data frame or data frame extension (e.g. a tibble). |
var1 |
A character string naming the first variable to get frequencies. |
var2 |
An optional character naming the second variable to get
frequencies. If |
by_vars |
An optional character vector naming variables in |
include_NA |
A logical. If |
values_to_remove |
An optional character vector. When specified all
values from |
weightvar |
An optional character naming a column in |
textvar |
An optional character. When specified |
number_decimals |
A numeric indicating the number of decimals to show on percentages and weighted frequencies in the combined frequency and percent variables. |
output |
A character indicating the output type wanted:
|
chisquare |
A logical. |
A frequency table as a data frame object.
ASO
freq_function_repeated()
to to get frequencies for multiple
variables in one go.
data("starwars", package = "dplyr")
test_table1 <- freq_function(
starwars,
var1 = "homeworld"
)
test_table2 <- freq_function(
starwars,
var1 = "sex",
var2 = "eye_color",
output = "total"
)
test_table3 <- freq_function(
starwars,
var1 = "hair_color",
var2 = "skin_color",
by_vars = "gender",
output = "col",
number_decimals = 5
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.