calculate_proportions | R Documentation |
This function creates a data.frame which includes 3 columns.
a column containing the variable's categories;
a column containing each category's frequency;
a column containing each category's proportion.
calculate_proportions(data, variable)
data |
An object of type data.frame. |
variable |
The name of the variable from which to calculate the proportions. |
A data.frame which includes 3 columns.
variable
: a column containing the variable's categories;
n
: a column containing each category's frequency;
prop
: a column containing each category's proportion.
CLESSN
## Not run:
# Calculate the proportions of each cylinder configuration
# from mtcars.
calculate_proportions(mtcars,cyl)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.