ctg_data_report {clintrialx} | R Documentation |
Generate a Comprehensive Clinical Trial Data Report
Description
This function creates a detailed, visually appealing HTML report from clinical trial data. It automates the process of data analysis and visualization, providing insights into various aspects of clinical trials such as study status, enrollment, duration, and funding sources.
Visit here for an example report - https://www.indraneelchakraborty.com/clintrialx/report.html.
Usage
ctg_data_report(
ctg_data,
title = "Clinical Trial Data Report",
author = "Author Name",
output_file = "./report.html",
color_palette = c("#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b"),
theme = "cerulean",
include_data_quality = TRUE,
include_interactive_plots = TRUE,
custom_footer = NULL
)
Arguments
ctg_data |
A data frame containing clinical trial data. Required columns include:
|
title |
Character string. The title of the report.
Default is |
author |
Character string. The name of the report author.
Default is |
output_file |
Character string. The file path where the HTML report will be saved.
Default is |
color_palette |
Character vector. A set of colors to be used in the report's visualizations. Default is a preset palette of 6 colors. You can provide your own color codes for customization. |
theme |
Character string. The Bootstrap theme for the HTML report.
Default is |
include_data_quality |
Logical. Whether to include a data quality assessment section.
Default is |
include_interactive_plots |
Logical. Whether to generate interactive plots using plotly.
Default is |
custom_footer |
Character string or |
Details
The function performs these key steps:
1. Package Management:
Checks for required packages and offers to install any that are missing.
Required packages:
rmarkdown
,ggplot2
,plotly
,dplyr
,lubridate
,reactable
,scales
,RColorBrewer
,htmltools
.
2. Report Generation:
Creates a temporary R Markdown file with the report content.
Includes an executive summary with key statistics.
Provides an interactive data table for easy exploration of the dataset.
3. Data Visualization:
Study Status Distribution: Bar chart showing the count of studies in each status.
Enrollment by Study Phase: Box plot displaying enrollment numbers across different study phases.
Study Duration Timeline: Scatter plot showing the relationship between study start dates and durations.
Funding Sources and Study Types: Stacked bar chart illustrating the proportion of study types for each funder type.
4. Optional Sections:
Data Quality Assessment: Bar chart showing the percentage of missing data for each variable (if enabled).
Interactive Plots: Uses plotly to create interactive versions of all plots (if enabled).
5. Report Finalization:
Renders the R Markdown file to an HTML report.
Cleans up temporary files.
Value
This function doesn't return a value, but generates an HTML report at the specified location. It prints a message with the path to the generated report upon successful completion.
Tips for Users
Ensure your data frame has all required columns before using this function.
Experiment with different themes to find the most suitable look for your report.
If you encounter any package installation issues, you may need to install them manually.
For large datasets, setting
include_interactive_plots = FALSE
may improve performance.Custom color palettes can be used to match your organization's branding.
The generated report is self-contained and can be easily shared or published on the web.
See Also
https://www.indraneelchakraborty.com/clintrialx/ for more information about the ClinTrialX package.