Skip to contents

add_output() puts a report on the list; copy_output() gives a new report every row of an existing one (the quickest start for a report like one already defined); rename_output() changes an id everywhere; remove_output() takes a report and all its rows out; sort_outputs() puts the list in its ids' order.

Usage

add_output(
  x,
  output_id,
  description = NA_character_,
  type = "table",
  process_code = NA_character_,
  section = NA_character_,
  population = NA_character_,
  at = c("natural", "end")
)

sort_outputs(x)

copy_output(x, from, to)

rename_output(x, from, to)

remove_output(x, output_id)

Arguments

x

An tflplanner.

output_id, from, to

Report ids.

description

A short description shown in the report list.

type

The report's type, one of report_types(); anything but "table" is written on the report sheet.

process_code

A table's: R code that turns ard into data, what rtfreporter::table_plan() is given: rtfreporter::normalize_ard() and any rework after it (mutate() ...); NA: none, the table's plan normalizes ard (ard |> normalize_ard() |> table_plan()). A listing's: a rework of its data before it is sorted. (A step that is the report's own code instead: set_step_code().)

section

The section of the TOC the report is under (its heading, "14.1 Demographics"); NA: from its ID's numbers.

population

The report's analysis set, a population_id (see set_report_population(), which also makes its analysis data).

at

Where the new report goes: "natural" (where its id sorts among the others) or "end".

Value

The updated tflplanner.

Details

The list's order is the order the reports are made in (the official run too). A new report goes where its id sorts among the others – by the numbers in the id, as numbers (T-14-1-2 after T-14-1-1 and before T-14-1-10; T-14-0-1 before F-14-2-1, the sections' order), then its letters (T-14-1-1 before T-14-1-1S) – before the first report whose id sorts after it, so a list kept in id order stays so; one ordered by hand keeps that order. at = "end" puts it last (a TOC's reports come in the TOC's order).

Examples

p <- add_output(add_output(new_planner(), "T-14-1-10"), "T-14-1-1")
p <- add_output(p, "T-14-1-2")
p$outputs$output_id
#> [1] "T-14-1-1"  "T-14-1-2"  "T-14-1-10"
sort_outputs(add_output(p, "T-14-0-1", at = "end"))$outputs$output_id
#> [1] "T-14-0-1"  "T-14-1-1"  "T-14-1-2"  "T-14-1-10"