View source: R/export_report.R
| export_report | R Documentation |
Exports a dataset or CDISC comparison result to a file in multiple formats. Automatically detects format from file extension (.html, .txt, .xlsx).
export_report(result, file, format = NULL)
result |
A list from |
file |
Character string specifying the output file path. File extension determines format: .html, .txt, or .xlsx. |
format |
Character string specifying output format: "html", "text", or "excel". If NULL (default), format is auto-detected from file extension. |
Supported formats:
HTML (.html): Self-contained HTML report with styling and interactive charts.
Text (.txt): Plain text report suitable for console review.
Excel (.xlsx): Multi-sheet workbook with tabbed data:
"Summary": Dataset dimensions, domain, standard, matching type, tolerance
"Variable Diffs": Metadata attribute differences
"Value Diffs": Unified diff data frame from get_all_differences()
"CDISC Validation": Combined validation results (for CDISC comparisons only)
The result object can be either a dataset_comparison (from compare_datasets())
or cdisc_comparison (from cdisc_compare()). All features are supported for both.
Invisibly returns the input result (useful for piping).
# Create sample datasets
df1 <- data.frame(
ID = c(1, 2, 3),
NAME = c("Alice", "Bob", "Charlie"),
AGE = c(25, 30, 35)
)
df2 <- data.frame(
ID = c(1, 2, 3),
NAME = c("Alice", "Bob", "Charles"),
AGE = c(25, 30, 36)
)
# Compare datasets
result <- compare_datasets(df1, df2)
# Export to different formats (write to tempdir)
export_report(result, file.path(tempdir(), "report.html"))
export_report(result, file.path(tempdir(), "report.txt"))
# Explicit format specification
export_report(result, file.path(tempdir(), "report.xlsx"), format = "excel")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.