knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE )
This document provides instructions for installing the summata package and configuring the dependencies required for complete functionality. The package requires R ≥ 4.2.0 and several additional components for document generation.
Install the stable release from CRAN:
install.packages("summata")
Alternatively, install the stable release directly from GitHub:
install.packages("remotes") remotes::install_github("phmcc/summata")
For experimental builds, the development version is available from Codeberg:
remotes::install_git("https://codeberg.org/phmcc/summata.git")
Confirm successful installation by loading the package:
library(summata) packageVersion("summata")
The following packages are installed automatically as dependencies:
| Package | Purpose |
|:--------|:--------|
| data.table | High-performance data manipulation and core data operations |
| survival | Survival and time-to-event analysis |
| ggplot2 | Visualization system for forest plots and graphics |
| stats | Statistical functions and model fitting |
| grDevices | Graphics devices and color palettes |
Additional packages extend functionality for specific use-cases:
| Package | Purpose | Required For |
|:--------|:--------|:-------------|
| lme4 | Linear mixed-effects models | lmer(), glmer() model types |
| coxme | Mixed-effects Cox models | coxme() model type |
| xtable | LaTeX table generation | table2pdf(), table2tex(), table2html() |
| flextable | Office document tables | table2docx(), table2pptx(), table2rtf() |
| officer | Office document creation | table2docx(), table2pptx() |
| knitr | Dynamic document generation | R Markdown integration, vignettes |
| rmarkdown | R Markdown documents | Vignette rendering |
| ragg | High-quality graphics | Enhanced PNG rendering with better fonts |
| systemfonts | Font management | Font detection for graphics |
| tinytex | R-integrated LaTeX distribution | PDF table export via table2pdf() |
| MASS | Statistical methods | Model diagnostics and testing |
| MuMIn | Multi-model inference | Model selection and averaging |
| pROC | ROC curve analysis | Diagnostic performance evaluation |
| ResourceSelection | Goodness-of-fit tests | Hosmer-Lemeshow tests for logistic models |
| stringr | String manipulation | Text processing utilities |
| utils | Utility functions | Data import/export helpers |
| withr | Temporary state changes | Testing and safe state modifications |
Install optional dependencies as needed:
# For mixed-effects models install.packages(c("lme4", "coxme")) # For table export (all formats) install.packages(c("xtable", "flextable", "officer", "knitr", "tinytex")) # For enhanced graphics install.packages(c("ragg", "systemfonts")) # For model diagnostics and selection install.packages(c("MASS", "MuMIn", "pROC", "ResourceSelection"))
Or install all suggested packages at once:
install.packages("summata", dependencies = TRUE)
PDF and LaTeX export through table2pdf() and table2tex() require a LaTeX distribution.
TinyTeX provides a lightweight, R-integrated LaTeX distribution:
install.packages("tinytex") tinytex::install_tinytex()
Verify the installation:
tinytex::is_tinytex() tinytex::tlmgr_version()
TinyTeX installs required LaTeX packages automatically on first use.
Full LaTeX distributions may be installed system-wide:
| Distribution | Platform | URL | |:-------------|:---------|:----| | TeX Live | Cross-platform | https://www.tug.org/texlive/ | | MiKTeX | Windows | https://miktex.org/ | | MacTeX | macOS | https://www.tug.org/mactex/ |
For Debian/Ubuntu systems:
sudo apt install texlive-latex-base texlive-latex-extra texlive-fonts-recommended
The export functions utilize the following LaTeX packages:
| Category | Packages | |:---------|:---------| | Typography | fontenc, inputenc, helvet | | Tables | array, booktabs, longtable, colortbl | | Layout | geometry, pdflscape, lscape | | Graphics | graphicx, xcolor | | Specialized | standalone, varwidth, float, caption |
With TinyTeX, these packages install automatically. For standard distributions:
tlmgr install fontenc inputenc array booktabs longtable graphicx geometry \
pdflscape lscape helvet standalone varwidth float caption xcolor colortbl
Export to Word, PowerPoint, and RTF formats requires:
install.packages(c("flextable", "officer"))
These packages enable creation of .docx, .pptx, and .rtf files that can be opened and edited in Microsoft Office or compatible applications.
Execute the following to verify complete functionality:
library(summata) # Create test data test_data <- data.frame( Variable = c("Sample Size", "Mean", "Standard Deviation"), Value = c("150", "45.3", "12.1") ) # Test Word export (requires flextable, officer) table2docx(test_data, file = file.path(tempdir(), "verification_test.docx")) # Test PDF export (requires xtable, LaTeX) table2pdf(test_data, file = file.path(tempdir(), "verification_test.pdf")) # Clean up file.remove( file.path(tempdir(), "verification_test.docx"), file.path(tempdir(), "verification_test.pdf") )
Successful execution confirms proper configuration of all export-related dependencies.
If PDF generation fails, verify LaTeX accessibility:
Sys.which("pdflatex")
An empty return value indicates LaTeX is not in the system PATH. Solutions include:
tinytex::reinstall_tinytex()For TinyTeX, install missing packages directly:
tinytex::tlmgr_install("package_name")
For compilation errors, examine the log file:
table2pdf(test_data, file = file.path(tempdir(), "debug.pdf"), show_logs = TRUE)
Ensure repository access is configured:
options(repos = c(CRAN = "https://cloud.r-project.org"))
For packages requiring system libraries (Linux):
sudo apt install r-base-dev libcurl4-openssl-dev libssl-dev libxml2-dev
Verify write access to the target directory:
getwd() file.access(getwd(), mode = 2) # Returns 0 if writable
| Component | Requirement |
|:----------|:------------|
| R | ≥ 4.2.0 |
| Operating System | Windows, macOS, or Linux |
| RAM | 4 GB minimum; 8 GB recommended |
| Disk Space | Base package (< 5 MB)
TinyTeX (~150 MB)
Full LaTeX distribution (2–6 GB) |
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.