pcount | R Documentation |
count()
with percentagesShortcut for count(x) |> mutate(p = n/sum(n)). Returns APA compliant percentage values from table data.
pcount(tbl, x, rounded = TRUE, name = "n", ...)
tbl |
Table |
x |
The variable to count and calculate the percentage on. |
rounded |
logical. Return rounded percentage. If false decimal values will be used. |
name |
character. The name of the new column in the output. If omitted, it will default to n. |
... |
Other arguments passed to count. |
pcount()
returns the same as count()
with an aditional percentage column. See count.
## Not run: dat <- tibble(group = rep(1:5, each = 2), letter = c("a", "b", "a", "c", "a", "c", "b", "e", "b", "f")) pcount(dat, letter) pcount(dat, letter, sort = TRUE) pcount(dat, letter, name = "obs") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.