Skip to contents

block() joins a function of the results object to the name of the formatter that formats its value. make_blocks() evaluates the function and writes its raw value to the blocks file.

Usage

block(fn, format, items = character(0))

Arguments

fn

A function of one argument, the results object. It MUST return a data.frame of numbers. A character or a factor column MAY hold labels, but no cell of it holds a formatted number, such as "1.2" or "5%".

format

One string that is not NA and not empty: the name of a formatter.

items

A character vector of "<id>:<item>" strings, without names. An <id> holds lower-case letters, digits and -. An <item> holds no space and no :. Each string comes once.

Value

A list with the elements fn, format and items, of the class writeit_block. items has no names.

Examples

b <- block(
  function(results) return(results$estimates),
  format = "ci",
  items = "guide:4a"
)
class(b)
#> [1] "writeit_block"