Reporting Workflows
Report Sections
Ordered Blocks
A generated report is easier to assemble when each section has a clear title and body text before rendering.
Program
Play the script to choose how many sections are included in a report outline.
report_sections.R
titles <- c("Summary", "Method", "Result")
bodies <- c("daily totals", "fixed rules", "ready")
section_count <-
chosen_titles <- titles[seq_len(section_count)]
chosen_bodies <- bodies[seq_len(section_count)]
sections <- paste(chosen_titles, chosen_bodies, sep = ":")
label <- paste(sections, collapse = "|")
cat(label, "\n", sep = "")
titles <- c("Summary", "Method", "Result")
bodies <- c("daily totals", "fixed rules", "ready")
section_count <-
chosen_titles <- titles[seq_len(section_count)]
chosen_bodies <- bodies[seq_len(section_count)]
sections <- paste(chosen_titles, chosen_bodies, sep = ":")
label <- paste(sections, collapse = "|")
cat(label, "\n", sep = "")
titles <- c("Summary", "Method", "Result")
bodies <- c("daily totals", "fixed rules", "ready")
section_count <-
chosen_titles <- titles[seq_len(section_count)]
chosen_bodies <- bodies[seq_len(section_count)]
sections <- paste(chosen_titles, chosen_bodies, sep = ":")
label <- paste(sections, collapse = "|")
cat(label, "\n", sep = "")
outline
Report assembly can start from vectors of section titles and body snippets.
seq_len
`seq_len(section_count)` creates the selected section positions.
section
`paste(chosen_titles, chosen_bodies, sep = ":")` builds one display block per section.