snip_lowest: A 'fn' for 'info_snippet()': get the lowest value from a...

View source: R/info_add.R

snip_lowestR Documentation

A fn for info_snippet(): get the lowest value from a column

Description

The snip_lowest() function can be used as an info_snippet() function (i.e., provided to fn) to get the lowest numerical, time value, or alphabetical value from a column in the target table.

Usage

snip_lowest(column)

Arguments

column

The target column

⁠scalar<character>⁠ // required

The name of the column that contains the target values.

Value

A formula needed for info_snippet()'s fn argument.

Examples

Generate an informant object, add a snippet with info_snippet() and snip_lowest() (giving us a method to get the lowest value in column a). Define a location for the snippet result in { } and then incorporate() the snippet into the info text. Note here that the order of the info_columns() and info_snippet() calls doesn't matter.

informant <- 
  create_informant(
    tbl = ~ small_table,
    tbl_name = "small_table",
    label = "An example."
  ) %>% 
  info_columns(
    columns = a,
    `Lowest Value` = "Lowest value is {lowest_a}."
  ) %>%
  info_snippet(
    snippet_name = "lowest_a",
    fn = snip_lowest(column = "a")
  ) %>%
  incorporate()

We can print the informant object to see the information report.

informant
This image was generated from the first code example in the `snip_lowest()` help file.

Function ID

3-8

See Also

Other Information Functions: info_columns(), info_columns_from_tbl(), info_section(), info_snippet(), info_tabular(), snip_highest(), snip_list(), snip_stats()


pointblank documentation built on Oct. 30, 2024, 9:29 a.m.