Learn R Programming

clinCompare (version 1.0.0)

generate_cdisc_report: Generate CDISC Validation Report

Description

Generates a formatted report from the results of cdisc_compare(). Supports both text-based console output and HTML reports with professional styling and color-coding.

Usage

generate_cdisc_report(cdisc_results, output_format = "text", file_name = NULL)

Value

Invisibly returns the input cdisc_results (useful for piping).

Arguments

cdisc_results

A list output from cdisc_compare().

output_format

Character string: either "text" (default) for console output or "html" for HTML report.

file_name

Optional character string specifying the output file path. For text format, the report is appended to this file. For HTML format, must be explicitly provided by the user. If NULL, output is not written to file.

Details

The report includes:

  • Dataset Comparison Summary

  • CDISC Compliance for each dataset

  • CDISC Conformance Comparison

For text output, formatting uses console-friendly layout. For HTML output, a self-contained report is generated with color-coded severity levels: red for ERROR, orange for WARNING, blue for INFO.

Examples

Run this code
if (FALSE) {
# Create sample datasets
dm1 <- data.frame(
  STUDYID = "STUDY001",
  USUBJID = c("SUBJ001", "SUBJ002"),
  DMSEQ = c(1, 1),
  RACE = c("WHITE", "BLACK OR AFRICAN AMERICAN")
)

dm2 <- data.frame(
  STUDYID = "STUDY001",
  USUBJID = c("SUBJ001", "SUBJ003"),
  DMSEQ = c(1, 1),
  RACE = c("WHITE", "ASIAN")
)

result <- cdisc_compare(dm1, dm2, domain = "DM")

# Generate text report to console
generate_cdisc_report(result, output_format = "text")

# Generate HTML report to file
out <- file.path(tempdir(), "report.html")
generate_cdisc_report(result, output_format = "html", file_name = out)
}

Run the code above in your browser using DataLab