dmai_interpret: Plain-language interpretation of a result

View source: R/interpret.R

dmai_interpretR Documentation

Plain-language interpretation of a result

Description

dmai_interpret() turns a result of the package into a short report: a headline, findings, recommendations and cautions, computed from its numbers, with the sources of the method. It covers dmai() (with as_dt = FALSE), dmai_compare(), dmai_user_cost() and dmai_moments().

Usage

dmai_interpret(x, top = 3L, ...)

## Default S3 method:
dmai_interpret(x, top = 3L, ...)

## S3 method for class 'dmai_interpretation'
print(x, ...)

## S3 method for class 'dmai_interpretation'
format(x, style = c("text", "markdown"), width = getOption("width", 80L), ...)

Arguments

x

a result of a function of the package.

top

number of dates or components named in the findings (default 3).

...

unused.

style

"text" (default) or "markdown".

width

line width of the text (default getOption("width")).

Details

Growth per year is the average growth between the first and last dates, annualised with the spacing of the dates (monthly, quarterly, half-yearly or annual) when the date column is of class Date; otherwise growth is reported per period.

Value

An object of class "dmai_interpretation": a list with analysis, title, headline, findings, recommendations, cautions, facts (the numbers behind the sentences), guide (how to read the method) and sources. format() gives it as text or Markdown.

Author(s)

Muhammad Yaseen (myaseen208@gmail.com)

See Also

dmai_cite, dmai_app

Examples

data(money_sim)
fit <-
  dmai(
      .data     = money_sim
    , method    = "Barnett"
    , logbase   = NULL
    , date      = "Date"
    , x         = NULL
    , r         = NULL
    , user_cost = NULL
    , benchmark = "rb"
    , percent   = TRUE
    , base      = 100
    , as_dt     = FALSE
    )
dmai_interpret(
    x   = fit
  , top = 3
  )

dmai documentation built on Nov. 9, 2026, 9:07 a.m.