Semi-Automatic Reporting of Ordinary Surveys
Overview
Offers a systematic way for conditional reporting of figures and tables for many (and bivariate combinations of) variables, typically from survey data. Contains interactive 'ggiraph'-based (https://CRAN.R-project.org/package=ggiraph) plotting functions and data frame-based summary tables (bivariate significance tests, frequencies/proportions, unique open ended responses, etc) with many arguments for customization, and extensions possible. Uses a global options() system for neatly reducing redundant code. Also contains tools for immediate saving of objects and returning a hashed link to the object, useful for creating download links to high resolution images upon rendering in 'Quarto'. Suitable for highly customized reports, primarily intended for survey research.
Breaking Changes
- **Removed deprecated
embed_*functions**:embed_cat_prop_plot(),embed_cat_table(), andembed_chr_table_html()have been removed. These were soft-deprecated since v1.1.0. Usemakeme()instead (e.g.,makeme(type = "cat_prop_plot_html"),makeme(type = "cat_table_html"),makeme(type = "chr_table_html")). - **
cat_plot_docxnow uses girafe global settings for colors**: Thecolour_paletteparameter has been removed fromcat_plot_docx. Instead, colors are now controlled exclusively throughglobal_settings_set(fn_name = "girafe")for consistency with HTML plots. This enables unified color management across all output formats (HTML and DOCX). Checkbox plot support (checked,not_checked,colour_2nd_binary_cat) is now also available for DOCX plots, with automatic legend hiding and label suppression for the unchecked category. Users should migrate frommakeme(..., colour_palette = c(...))toglobal_settings_set(fn_name = "girafe", new = list(palette_codes = list(c(...)))).
New Features
crowd_plots_as_tabset()andcrowd_tables_as_tabset()now insert Quarto{{< pagebreak >}}shortcodes between items when rendering to paginated formats (docx, typst, PDF). HTML-based formats (including revealjs and slidy) are detected viaknitr::is_html_output()and are never page-broken. A newpagebreakparameter ("auto","always","never") controls this behaviour- Added
check_quarto_website_index()function to detect folders in a Quarto website project that contain.qmdfiles but are missing anindex.qmd. Missing index files often cause broken navigation menus. Issues acliwarning listing the offending folders. - Added
quarto_pdf_post_render()function for use as a Quarto post-render script. For each rendered PDF, it checks for a matching DOCX file, extracts the document title from the DOCX metadata, sets it as the PDF metadata title (via Ghostscript), and updates the link text in the correspondingindex.html. Defaults to reading output files from theQUARTO_PROJECT_OUTPUT_FILESenvironment variable set by Quarto during project render. - Added
make_file_links()function for dynamically creating markdown lists with links to files. Extracts document titles from DOCX, PPTX, and PDF file metadata and generates formatted markdown lists. Ideal for creating navigation links in Quarto/RMarkdown documents that point to generated reports in a folder. Supports glob patterns, recursive search, and customizable list formatting (unordered or numbered). It appends a file extension suffix to link labels when multiple file types are present for the same base name, making it clear which format each link points to. - Enhanced
ggsaver()to automatically apply colour palettes fromgirafe()global settings when saving plots. This ensures saved PNG/PDF images match the appearance of interactive plots displayed withgirafe(). Palette settings can be configured viaglobal_settings_set(fn_name = "girafe", new = list(palette_codes = ...))and will be automatically applied when saving plots throughget_fig_title_suffix_from_ggplot()or directggsaver()calls - Added
folderandfile_prefixparameters toget_fig_title_suffix_from_ggplot()for controlling where files are saved and what prefix to use for filenames - Enhanced
get_fig_title_suffix_from_ggplot()to support global settings inheritance viaglobal_settings_set(), consistent with other saros functions likemake_link()andmakeme() - **Unified DOCX plot types**: Merged
cat_prop_plot_docxandcat_freq_plot_docxinto a singlecat_plot_docxtype, bringing it in line with thecat_plot_htmlAPI. Thefreqparameter now controls whether to create stacked proportion/percentage plots (freq=FALSE, default) or dodged frequency plots (freq=TRUE)
Show all changes in 1.6.2Hide the rest of the changes in 1.6.2
- **Added DOCX table types**: New
cat_table_docxandchr_table_docxoutput types for creating Word document tables. These types useofficer::body_add_table()to embed tables in Word documents. Like HTML table types, they return data.frames whendocx_return_object=TRUE, enabling flexible table composition - Added
docx_return_objectparameter tomakeme()to control return type for DOCX outputs. WhenTRUE, returns the underlying object (mschart for plots, data.frame for tables) instead of embedding it in an rdocx document, enabling more flexible composition of Word documents - **Refactored
fig_height_h_barchart2()to S3 generic**: Now supports bothggplot2objects (fromtype="cat_plot_html") andmschartobjects (fromtype="cat_plot_docx", docx_return_object=TRUE). This enables automatic height calculation for Word charts, making it easier to size charts consistently across output formats - **Refactored
n_range2()to S3 generic**: Now supports bothggplot2objects andmschartobjects, similar tofig_height_h_barchart2(). This enables consistent sample size reporting across both HTML and Word chart outputs, making it easier to annotate charts with N ranges regardless of output format
Bug Fixes
- Updated
make_link()tests to use dynamicrlang::hash()values instead of hardcoded hashes, preventing fragile failures when hash representations change across environments or versions (#587) crowd_plots_as_tabset()now gives an informative error when passed table output (e.g. fromtype = "cat_table_html") instead of plot output, directing users tocrowd_tables_as_tabset()(#515)txt_from_cat_mesos_plots()now gives an informative error when passed table output instead of plot output, instead of failing with a cryptic.category_ordercolumn-not-found error (#515)- Fixed
girafe()to return a staticggplotobject instead of agirafeobject when rendering in non-HTML knitr documents (e.g. PDF, Word). Previously the interactive widget was returned unconditionally, causing rendering failures in non-HTML output formats (#551) - Fixed
cat_plot_htmldata labels being left-aligned instead of centered. Thehjustvalue forgeom_labelwas corrected from 0 to 0.5 (#553) - Fixed
txt_from_cat_mesos_plots()for checkbox variables to compare on thecheckedcategory (or the first non-NA category as fallback) rather than always using the first category. This ensures the correct proportion is highlighted when the variable useschecked/not_checkedencoding (#556) - Fixed
txt_from_cat_mesos_plots()color legend inconsistency across mesos groups. Category color assignment now only computes full factor levels for factor/ordered variables, preventing spurious extra colors from appearing in legends for non-factor variables (#552, #555) - Fixed
txt_from_cat_mesos_plots()showing zero proportions due to.variable_label_originalbeing overwritten by the N-suffix mutation inadd_n_to_label()before it could be used for joining. The original column is now preserved before any label mutation (#554) - Fixed
int_plot_htmlto always hide the fill legend (previously shown for single dep without indep), and to correctly respecthide_axis_text_if_single_variable(previously ignored forint_plot_html, only applied tocat_plot_html) (#557) - Fixed
cat_plot_docxpercentage plots to show consistent axis breaks at 0%, 25%, 50%, 75%, and 100% by setting axis limits (0-1) and major unit (0.25; experimental) for the y-axis. This improves readability and consistency across Word document charts - Fixed default font sizes for
cat_plot_docx: increasedlabel_font_sizeandmain_font_sizedefaults from 6 to 9 for better readability in Word documents - Fixed
hide_axis_text_if_single_variableparameter not being respected incat_plot_docxoutput. The function now properly hides axis labels for single-variable plots when this parameter isTRUE, matching the behavior ofcat_plot_html - Fixed
colour_paletteparameter not being applied incat_plot_docxoutput. The mschart library requires colour palettes to be named vectors where names match category levels, and the length must match the number of categories. The function now: (1) names the colour palette vector with category levels, (2) expands the palette with generated colours if user provides fewer colours than categories, and (3) trims the palette if user provides more colours than needed - Fixed
set_pdf_metadata_title()corrupting non-ASCII characters (e.g. æøå) in PDF metadata titles. The pdfmark title is now encoded as a UTF-16BE hex string with BOM instead of a plain PostScript literal, avoiding locale/codepage-dependent byte interpretation by Ghostscript - Fixed
fig_height_h_barchart2()wherehide_axis_text_if_single_variable=TRUEwas paradoxically giving larger heights thanFALSE. Now correctly detects when axis text has been hidden (via.variable_label_originalcolumn) and applies a reduction factor (default 0.6 viamultiplier_hide_axis_single_varparameter) plus reduced minimum height, resulting in appropriately smaller plots when axis text is hidden - Fixed
fig_height_h_barchart2()forint_plot_htmlplots: previously always returnedmax(12) regardless of plot complexity, and errored with "only supports a single indep variable" when an indep variable was present (because.valuewas falsely detected as a second indep column). Height now scales properly withn_yandn_cats_xviafig_height_h_barchart()withn_cats_y = 1andn_legend_lines = 0 - Fixed
n_range2()forint_plot_htmlplots to report N range per dependent variable instead of total count across all variables. Now correctly calculates sample size separately for each variable and reports the range (e.g., [250-299] when variables have different amounts of missing data) - Fixed
guess_legend_ncols()ingirafe()to properly handle fill aesthetics using expressions likefill = factor(cyl). The function now usesget_fill_levels()to evaluate expressions in data context instead of direct column access, preventing "no non-missing arguments to max; returning -Inf" warnings makeme()now gives an informative error message when the requested output type is incompatible with the dependent variable types (e.g., usingtype = "cat_table_html"with numeric variables, ortype = "int_plot_html"with factor variables). Previously this produced a cryptic error about setting an attribute on NULL.
Internal Improvements
- **Optimized
fig_height_h_barchart2()ggplot height estimation**: The function now extracts information directly from the ggplot object for more accurate height calculations: - Reads the actual font size from the ggplot theme (
base_size) instead of using a fixed default, so heights scale correctly when users change the global ggplot2 theme (e.g.,theme_gray(base_size = 14)) - Detects legend position from the theme — when the legend is at the sides (
"right","left") or hidden ("none"), no vertical space is allocated for it, producing more compact figures - Simulates actual text wrapping (via
count_max_wrapped_lines()) to count the true number of lines labels wrap to, instead of estimating from character counts - Fixed
fig_height_h_barchart()strip angle condition to useabs(strip_angle), so negative angles (e.g., -90° from default ggplot2 strip themes) are handled identically to their positive counterparts - Extracted shared color resolution logic into
resolve_category_colors()helper, removing duplication acrossmake_content.cat_plot_html(),make_content.cat_plot_docx(), and related functions (#548) - **Major refactoring of validation infrastructure** (implements refactoring opportunities #1 and #4):
- All validation functions now use consistent
validate_*prefix for better discoverability via auto-complete (e.g.,validate_bool(),validate_integerish(),validate_double(),validate_string()) - Added
validate_params()helper function that consolidates multiple parameter validations into a single declarative call, reducing code duplication from 30+ lines to ~5 lines infig_height_h_barchart() - Created validation rule builders (
validate_integerish_rule(),validate_double_rule(),validate_bool_rule(),validate_string_rule()) for more expressive and maintainable validation specifications invalidate_makeme_options() - Maintained backwards compatibility with
check_*aliases for existing code - Improved code maintainability and readability across validation-heavy functions
- Added
is_int_plot_html()helper function to centralize detection logic for int_plot_html data structures, improving code maintainability and consistency acrossfig_height_h_barchart2()andn_rng2()
From NEWS.md in the release
Install
Health
- OK13 OK2026-10-17
- ERROR12 OK, 1 ERROR2026-09-24
- OK13 OK2026-09-04
- ERROR12 OK, 1 ERROR2026-09-01
- OK13 OK2026-08-04
Show 10 earlier changesHide 10 earlier changes
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-27
- ERROR12 OK, 1 ERROR2026-06-24
- OK13 OK2026-06-15
- ERROR12 OK, 1 ERROR2026-06-11
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-07
- OK13 OK2026-05-10
- ERROR12 OK, 1 ERROR2026-05-08
- OK14 OK2026-03-10
Documentation
- Help pages
- 135 (104 internal)includes a package overview page
- Examples that run
- 59%16 run in a plain check · 11 never run
- Exported functions with examples
- 93%
- Documented parameters
- 83%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 99%
- Median days to close, 50 most recently updated closed issues
- 150
- Median days to close, 50 most recently updated closed PRs
- 0
Issues over time
PRs over time
Commits over time
15 development-tooling and community-health practices detected across 7 families in the upstream repository
Checks run against github.com/nifu-no/saros on 2026-10-25.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-23 · The repository has a site deploy workflow
pkgdown site last built 2026-10-23
Show all practicesHide 3 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-03-18Seen in the repository: .claudeNamed in .Rbuildignore: .claudePull request it wrote: opened by a project memberCommits: at least 23 crediting it in the message
- GitHub Copilotfirst seen on or before 2026-08-19Commits: at least 1 crediting it in the message
- Copilot code reviewCommits: at least 4 accepting its review suggestions
- Claude Opus 512 commits · Aug 2026
- Claude Opus 4.610 commits · Mar 2026
- Claude Fable 5.11 commit · Oct 2026
Dependencies
Installing saros adds 73 packages (41 with compiled code, 66 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, data.table 5.7 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 1.6.2Latest2026-04-29 · current release · diff ↗ ·
removed 5 exports
embed_cat_prop_plot, embed_cat_table, embed_chr_table_html, tabular_read, tabular_writeadded 17 exports
check_quarto_website_index, crowd_output, crowd_plots_as_docx, crowd_plots_as_officer, crowd_tables_as_tabset, fig_height_h_barchart2.default, fig_height_h_barchart2.ggplot, fig_height_h_barchart2.ms_chart, get_dep_label_prefix, insert_text, is_rendering, make_file_links, n_range2.default, n_range2.ggplot, n_range2.ms_chart, output_format, quarto_pdf_post_render - RR 4.6.0 released · 2026-04-24
- 1.6.12026-01-28 · diff ↗
- 1.6.02025-11-10 · diff ↗ ·
added 5 exports
crowd_plots_as_tabset, get_fig_title_suffix_from_ggplot, tabular_read, tabular_write, txt_from_cat_mesos_plots - 1.5.42025-06-04 · diff ↗
- 1.5.32025-06-02 · diff ↗
- RR 4.5.0 released · 2025-04-11
- 1.5.12025-02-12 · diff ↗
- 1.5.0
- 1.2.02024-09-03 · diff ↗ ·
removed 39 exports
attach_qualtrics_labels, center_string, col_to_binaries, combn_upto, create_caption, create_email_credentials, crosstable3, draft_report, embed_cat_freq_plot, embed_cat_freq_plot_docx, embed_cat_prop_plot_docx, embed_cat_text_html, embed_sigtest, filename_sanitizer, get_colour_palette, get_colour_set, handpick, hex_bw, is_colour, list_available_element_types, omitted_recoder_df, post_render_docx_img_replacer, prepare_chunk, prepare_safe_render, quarto_render_saros, read_default_draft_report_args, refine_chapter_overview, remove_label_parts, remove_special_chars_in_labels, rename_by_labels and 9 moreadded 13 exports
embed_chr_table_html, fig_height_h_barchart, fig_height_h_barchart2, get_makeme_types, ggsaver, global_settings_get, global_settings_reset, global_settings_set, make_content, make_link, makeme, n_range, n_range2 - RR 4.4.0 released · 2024-04-24
- 1.0.42024-02-29 · diff ↗
- 1.0.12024-01-26
- RR 4.3.0 released · 2023-04-21
Package metadata
- First published
- 2024-01-26
- Total releases
- 10 / 2 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.2.0
- Bundled data
- 5.4 KB / 1 file
- Download size
- 470 KB
Cite
Cite this package
Run in R for the authors' entry:
citation("saros")The package provides a citation file, so citation() returns the authors' own entry.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.