# You can use 'add_headline_column()' to reference values in an existing data set.
# Here is an example comparing the box office sales of different Pixar films
head(pixar_films) |>
dplyr::select(film, bo_domestic, bo_intl) |>
add_headline_column(
x = bo_domestic,
y = bo_intl,
headline = "{film} was ${delta}M higher {trend} (${x}M vs ${y}M)",
trend_phrases = trend_terms(more = "domestically", less = "internationally")
) |>
knitr::kable("pandoc")
# You can also use 'return_cols' to return any and all "talking points".
# You can use tidyselect helpers like 'starts_with("delta")' or
# 'everything()'. In this example, I returned the 'raw_delta' & 'trend' columns
# and then identified the records at the extremes
pixar_films |>
dplyr::select(film, bo_domestic, bo_intl) |>
add_headline_column(
x = bo_domestic,
y = bo_intl,
headline = "${delta}M {trend} (${x}M vs ${y}M)",
trend_phrases = trend_terms(more = "higher", less = "lower"),
return_cols = c(raw_delta, trend)
) |>
dplyr::filter(raw_delta %in% range(raw_delta)) |>
knitr::kable("pandoc")
Run the code above in your browser using DataLab