Skip to contents

Writes the rtfreporter calls a report definition stands for – the page, the running header and footer, the content, the titles and footnotes – as doc <- rtf_document(...) and one doc <- rtf_*(doc, ...) a step: what tfl_report() does, as a program that needs only rtfreporter. The document says its file, rtf_document(file = ) – tfl_report_path()'s path – so generate_rtfreport(doc) writes it.

Usage

tfl_report_code(
  spec,
  output_id = NULL,
  content = "content",
  doc = "doc",
  setup = FALSE,
  study = NULL
)

Arguments

spec

A report definition (tfl_read_report_spec()) narrowed to one report, or the path(s) to read it from; or a report of the YAML spec (tfl_output(), resolved: tfl_resolve_output()), its page: the calls – rtf_page, rtf_default_format, rtf_document, rtf_tables / rtf_figures, rtf_titles, rtf_footnotes, each its arguments, and the lines of header, footer, titles, footnotes and the tokens.

output_id

The report, when spec is a path or still defines several.

content

The name of the report's content in the program: a plan (tfl_table_code()), rtftable pages (tfl_listing_code()) or the figures.

doc

The name the document is assigned to.

setup

TRUE: the program runs after the study's setup code (tfl_report_setup_code()), so it leaves out what that defines: the study's tokens (rtfreporter fills from the document's first, then options(rtfreporter.tokens = )), and the study's header and footer, said by name (study_header, study_footer; a line the report's tokens leave empty, a blank <{OUTPUT_POPULATION}>, is left out when the file is written) – unless the report has its own, written here as before. FALSE (default): the program stands alone. For a YAML report, the study's are its defaults (spec/defaults.yml), the report's its pattern and its own: give the report as read (tfl_read_output()) and its study.

study

For a YAML report: the study (tfl_read_study_spec()), for its program (the TOC's program, else settings: program, in settings: program_dir), and where the report's titles and footnotes print: settings: titles_at header (the running header, after the study's lines) or titles (above the table), footnotes_at footer (the running footer, before the study's lines) or footnotes (below the table); not set, above and below the table.

Value

The code, one element per line.

Examples

spec <- tfl_read_report_spec(
  system.file("extdata", "ard-spec", c("report.xlsx", "study.xlsx"),
              package = "tflspec"), output_id = "DM")
cat(tfl_report_code(spec, content = "plan"), sep = "\n")
#> doc <- rtf_document(program = "C:\\study\\tfl\\DM", file = "output/DM.rtf") |>
#>   rtf_section(
#>     header = rtf_header(
#>       list(
#>         c(l = "Example Pharma", r = "Clinical Study Report"),
#>         c(l = "Study XYZ-ONC-01", r = "Page {PAGE} of {TOTAL_PAGES}"),
#>         c(c = ""),
#>         c(c = "Table 14.1.2"),
#>         c(c = "Demographics and Baseline Characteristics"),
#>         c(c = "Safety Population")
#>       )
#>     ),
#>     footer = rtf_footer(
#>       list(
#>         c(l = "SD: standard deviation; Min: minimum; Max: maximum; ECOG: Eastern Cooperative Oncology Group."),
#>         c(l = "{PROGRAM}       Generated on: {DATETIME}")
#>       )
#>     )
#>   ) |>
#>   rtf_tables(plan)