Learn R Programming

pointblank (version 0.7.0)

snip_highest: A fn for info_snippet(): get the highest 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 highest numerical, time value, or alphabetical value from a column in the target table.

Usage

snip_highest(column)

Arguments

column

The name of the column that contains the target values.

Value

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

Function ID

3-8

See Also

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

Examples

Run this code
# NOT RUN {
# Generate an informant object, add
# a snippet with `info_snippet()`
# and `snip_highest()` (giving us a
# method to get the highest value in
# column `a`); define a location for
# the snippet result in `{ }` and
# then `incorporate()` the snippet
# into the info text
informant <- 
  create_informant(
    read_fn = ~ small_table,
    tbl_name = "small_table",
    label = "An example."
  ) %>% 
  info_columns(
    columns = "a",
    `Highest Value` = "Highest value is {highest_a}."
  ) %>%
  info_snippet(
    snippet_name = "highest_a",
    fn = snip_highest(column = "a")
  ) %>%
  incorporate()

# We can print the `informant` object
# to see the information report

# }

Run the code above in your browser using DataLab