render_results: Render analysis results to a formatted HTML report

View source: R/analysis_plan.R

render_resultsR Documentation

Render analysis results to a formatted HTML report

Description

Generates a self-contained HTML report from the output of run_analysis_plan(). Each section corresponds to one research question and includes the APA-formatted statistical result, an interpretation space, and a reference list.

Usage

render_results(
  results = NULL,
  instrument,
  output_file = NULL,
  output_path = NULL,
  citation_format = c("apa", "ama", "vancouver"),
  title = NULL,
  interpretations = NULL
)

Arguments

results

An sframe_analysis_results object from run_analysis_plan().

instrument

An sframe object.

output_file

Character or NULL. Path to the output HTML file. When NULL, a temporary file is written and its path returned.

output_path

Character or NULL. Alias for output_file.

citation_format

Character. Reference format. One of "apa", "ama", or "vancouver". Defaults to "apa".

title

Character or NULL. Report title. Defaults to the instrument title with " – Results" appended.

interpretations

Named list or NULL. Written interpretations keyed by analysis-plan block id, added after the results are known. A block with an entry shows that text in its Interpretation section in place of the pre-declared prompt fallback. Blocks without an entry render exactly as they do when this argument is NULL. Interpretations are report content only and are never written into the instrument.

Value

The output file path, invisibly.

See Also

run_analysis_plan(), render_report()

Examples

instr <- read_sframe(
  system.file("extdata", "tourism_services_demo.sframe",
              package = "surveyframe")
)
responses <- read_responses(
  system.file("extdata", "tourism_services_responses.csv",
              package = "surveyframe"),
  instr,
  respondent_id = "respondent_id",
  submitted_at = "submitted_at",
  meta_cols = "started_at"
)

results <- run_analysis_plan(responses, instr)
out <- render_results(results, instr,
                      output_file = tempfile(fileext = ".html"))
file.exists(out)


surveyframe documentation built on July 25, 2026, 1:07 a.m.