Format the Narrative with HTML tags for Interactive Reports and Applications
Source:R/to_html.R
to_html.Rd
Format the Narrative with HTML tags for Interactive Reports and Applications
Arguments
- narrative
List of narratives returned by narrate_* function
- format_percentage
Add percentage formatting to text
- title_tag
HTML tag to be added to the names of the narrative
- ...
Other arguments passed to
format_pct()
function
Value
html character()
of text strings
Examples
library(dplyr)
sales %>%
group_by(Region, Product) %>%
summarise(Sales = sum(Sales, na.rm = TRUE)) %>%
arrange(desc(Sales)) %>%
narrate_descriptive() %>%
to_html()
#> <h4> Total Sales </h4> Total Sales across all Regions is 38790478.4. <h4> Region by Sales </h4> Outlying Regions by Sales are NA (18079736.4, <b><span style='color: green;'>46.6 %</span></b>) and EMEA (13555412.7, <b><span style='color: green;'>34.9 %</span></b>). <h4> NA by Product </h4> In NA, significant Products by Sales are Food & Beverage (7392821, <b><span style='color: green;'>40.9 %</span></b>) and Electronics (3789132.7, <b><span style='color: green;'>21 %</span></b>). <h4> EMEA by Product </h4> In EMEA, significant Products by Sales are Food & Beverage (5265113.2, <b><span style='color: green;'>38.8 %</span></b>) and Electronics (3182803.4, <b><span style='color: green;'>23.5 %</span></b>). <h4> Product by Sales </h4> Outlying Products by Sales are Food & Beverage (15543469.7, <b><span style='color: green;'>40.1 %</span></b>) and Electronics (8608962.8, <b><span style='color: green;'>22.2 %</span></b>).