txt_pct_fr | R Documentation |
Summary text functions for html tables
txt_pct_fr(var, referent_value, na.rm = TRUE)
var |
A vector, or variable name within a dataframe |
referent_value |
A character string to define the reference value |
na.rm |
a logical value indicating whether NA values should be stripped |
library(dplyr)
txt_pct_fr(mtcars$gear, 4)
mtcars %>%
group_by(cyl) %>%
summarise(pct_4gears = txt_pct_fr(gear, 4)) # shows what percentage have 4 gears (selected reference) and (with fraction)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.