prop_table | R Documentation |
Create a simple relative frequency table with percentages, optionally while using sampling weights.
prop_table(vec, weights = NULL, na.rm = FALSE, round_perc = 1)
vec |
A vector. |
weights |
A numeric vector of non-negative weights. |
na.rm |
Set to |
round_perc |
With how many decimals should the percentages be given? |
Returns a data.frame with 1 row.
# without weights
prop_table(mtcars$cyl)
# with weights
prop_table(mtcars$cyl, weights = rep(c(0.5, 1), 16))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.