Description Usage Arguments Examples
This function creates nicely formatted tables in R Markdown documents. It is designed to work with data formatting functions from the "formattable" package. Remember that columns formating must be applied before calling the format_my_table().
1 2 |
df |
A data frame |
format |
Select the kable format. Possible options are: NA (default) which is equivalent to "html", "latex" and "DT" |
width |
Should the table have full-page width? Defaults to FALSE |
font_size |
What font size should be used? Defaults to 12 |
scroll_box |
Should the table be enframed in a scroll-box? Defaults to NA. This option is very usefull when dealing with long tables. Must be used as character in the following format "600px" |
fit_to_page |
Should the table be scaled to page in "latex" tables. Possible options are: NA (default) and "scale_down" |
filter |
Whether column filtering should be enabled. For posible options plese check ?DT::datatable |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | recipes::credit_data %>%
first_to_lower() %>%
calculate_share(job) %>%
format_my_table()
recipes::credit_data %>%
first_to_lower() %>%
calculate_share(job) %>%
mutate(
share = formattable::percent(share, 2),
n_group = formattable::color_tile("white", "orange")(n_group)
) %>%
format_my_table()
recipes::credit_data %>%
first_to_lower() %>%
calculate_share(job) %>%
mutate(n_group = formattable::color_tile("white", "red")(n_group)) %>%
format_my_table("DT")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.