MyNixOS website logo
Description

Compose Sentences to Describe Comparisons.

Create dynamic, data-driven text. Given two values, a list of talking points is generated and can be combined using string interpolation. Based on the 'glue' package.

headliner

CRAN_Status_Badge Downloads codecov R-CMD-check

The goal of headliner is to translate facts into insights. Given two values, headliner generates building blocks for creating dynamic text. These talking points can be combined using using glue syntax to add informative titles to plots, section headers or other text in a report.

Installation

You can install the dev version of headliner from github with:

devtools::install_github("rjake/headliner")

Let’s look at some of the talking points for the difference between 5 and 7:

library(headliner)

compare_values(5, 7) |> # returns a list
  view_list() # show as a data frame
#>                        value
#> x                          5
#> y                          7
#> delta                      2
#> delta_p                 28.6
#> article_delta            a 2
#> article_delta_p       a 28.6
#> raw_delta                 -2
#> raw_delta_p            -28.6
#> article_raw_delta       a -2
#> article_raw_delta_p  a -28.6
#> sign                      -1
#> orig_values          5 vs. 7
#> trend               decrease

We can string the talking points together like this:

headline(
  x = 5, 
  y = 7, 
  headline = "There was {article_delta_p}% {trend} ({orig_values})"
)
#> There was a 28.6% decrease (5 vs. 7)

See here for a longer introduction.

Metadata

Version

0.0.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows