Skip to content

saros

1.6.2Package record

Semi-Automatic Reporting of Ordinary Surveys

0packages depend
3.9Kdownloads / year
80.3%test coverage
13/13flavors OK

Overview

About
Maintained by Stephan DausCRAN page ↗GitHub ↗Website ↗Issues ↗Declared funders: Kristiania University College and Nordic Institute for The Studies of Innovation, Research and Education (NIFU)

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.

Changes in 1.6.2

Breaking Changes

  • **Removed deprecated embed_* functions**: embed_cat_prop_plot(), embed_cat_table(), and embed_chr_table_html() have been removed. These were soft-deprecated since v1.1.0. Use makeme() instead (e.g., makeme(type = "cat_prop_plot_html"), makeme(type = "cat_table_html"), makeme(type = "chr_table_html")).
  • **cat_plot_docx now uses girafe global settings for colors**: The colour_palette parameter has been removed from cat_plot_docx. Instead, colors are now controlled exclusively through global_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 from makeme(..., colour_palette = c(...)) to global_settings_set(fn_name = "girafe", new = list(palette_codes = list(c(...)))).

New Features

  • crowd_plots_as_tabset() and crowd_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 via knitr::is_html_output() and are never page-broken. A new pagebreak parameter ("auto", "always", "never") controls this behaviour
  • Added check_quarto_website_index() function to detect folders in a Quarto website project that contain .qmd files but are missing an index.qmd. Missing index files often cause broken navigation menus. Issues a cli warning 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 corresponding index.html. Defaults to reading output files from the QUARTO_PROJECT_OUTPUT_FILES environment 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 from girafe() global settings when saving plots. This ensures saved PNG/PDF images match the appearance of interactive plots displayed with girafe(). Palette settings can be configured via global_settings_set(fn_name = "girafe", new = list(palette_codes = ...)) and will be automatically applied when saving plots through get_fig_title_suffix_from_ggplot() or direct ggsaver() calls
  • Added folder and file_prefix parameters to get_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 via global_settings_set(), consistent with other saros functions like make_link() and makeme()
  • **Unified DOCX plot types**: Merged cat_prop_plot_docx and cat_freq_plot_docx into a single cat_plot_docx type, bringing it in line with the cat_plot_html API. The freq parameter 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_docx and chr_table_docx output types for creating Word document tables. These types use officer::body_add_table() to embed tables in Word documents. Like HTML table types, they return data.frames when docx_return_object=TRUE, enabling flexible table composition
  • Added docx_return_object parameter to makeme() to control return type for DOCX outputs. When TRUE, 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 both ggplot2 objects (from type="cat_plot_html") and mschart objects (from type="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 both ggplot2 objects and mschart objects, similar to fig_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 dynamic rlang::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. from type = "cat_table_html") instead of plot output, directing users to crowd_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_order column-not-found error (#515)
  • Fixed girafe() to return a static ggplot object instead of a girafe object 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_html data labels being left-aligned instead of centered. The hjust value for geom_label was corrected from 0 to 0.5 (#553)
  • Fixed txt_from_cat_mesos_plots() for checkbox variables to compare on the checked category (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 uses checked/not_checked encoding (#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_original being overwritten by the N-suffix mutation in add_n_to_label() before it could be used for joining. The original column is now preserved before any label mutation (#554)
  • Fixed int_plot_html to always hide the fill legend (previously shown for single dep without indep), and to correctly respect hide_axis_text_if_single_variable (previously ignored for int_plot_html, only applied to cat_plot_html) (#557)
  • Fixed cat_plot_docx percentage 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: increased label_font_size and main_font_size defaults from 6 to 9 for better readability in Word documents
  • Fixed hide_axis_text_if_single_variable parameter not being respected in cat_plot_docx output. The function now properly hides axis labels for single-variable plots when this parameter is TRUE, matching the behavior of cat_plot_html
  • Fixed colour_palette parameter not being applied in cat_plot_docx output. 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() where hide_axis_text_if_single_variable=TRUE was paradoxically giving larger heights than FALSE. Now correctly detects when axis text has been hidden (via .variable_label_original column) and applies a reduction factor (default 0.6 via multiplier_hide_axis_single_var parameter) plus reduced minimum height, resulting in appropriately smaller plots when axis text is hidden
  • Fixed fig_height_h_barchart2() for int_plot_html plots: previously always returned max (12) regardless of plot complexity, and errored with "only supports a single indep variable" when an indep variable was present (because .value was falsely detected as a second indep column). Height now scales properly with n_y and n_cats_x via fig_height_h_barchart() with n_cats_y = 1 and n_legend_lines = 0
  • Fixed n_range2() for int_plot_html plots 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() in girafe() to properly handle fill aesthetics using expressions like fill = factor(cyl). The function now uses get_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., using type = "cat_table_html" with numeric variables, or type = "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 use abs(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 across make_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 in fig_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 in validate_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 across fig_height_h_barchart2() and n_rng2()

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 5.5 min · r-release-macos-x86_64
Status changes
  • 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
Advisories

none known

Documentation

In release 1.6.2
README· In the repository, left out of the releaseVignettesYes · 4 · staticNEWSYes · 100% structured · mentions 1.6.2Citation fileYes · software entry onlyWebsiteYes · pkgdown
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

3.9K
CRAN downloads in the past year
Rank #9,393 · ~11/day · ~321/mo
Daily download trend is not available in this view yet.
39930 days
1.1K90 days
3.9K1 year
Compare downloads with other packages →
Also on113 r2u6 autocran

Repository

3Stars
0Forks
18Open issues
5Open PRs
6Releases
975Commits
2Commit identities
975 commits · Last activity 2026-10-23 · Default branch at 1.6.3, ahead of CRAN 1.6.2 (checked 2026-10-25)
Responsiveness
How these are sampled
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

2026-07-14 · 182026-10-24 · 18
PracticesBeta

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.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Governance and community (3)
Code of conductContributing guideIssue templates
Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-10-23 · The repository has a site deploy workflow

pkgdown site last built 2026-10-23

Coverage (1)
Coverage reporting (Codecov)
Show all practicesHide 3 practices
Reproducibility and dev environment (1)
data-raw/
CRAN release process (1)
cran-comments.md
Lint, format, editor (3)
AirVS CodeRStudio project
How this is detected·Detection ruleset v4 (2026-10-20)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2026-03-18
    Seen in the repository: .claude
    Named in .Rbuildignore: .claude
    Pull request it wrote: opened by a project member
    Commits: at least 23 crediting it in the message
  • GitHub Copilotfirst seen on or before 2026-08-19
    Commits: at least 1 crediting it in the message
Review tools
  • Copilot code review
    Commits: at least 4 accepting its review suggestions
Models named in its commits
  • Claude Opus 512 commits · Aug 2026
  • Claude Opus 4.610 commits · Mar 2026
  • Claude Fable 5.11 commit · Oct 2026
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
31 external dependencies (excludes base and recommended)

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.

Depends (1)
R >= 4.2.0
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (5)
Author, Maintainer since 1.0.1 (2024), Copyright holder
Contributor · added in 1.2.0
Author of internal scale_x_reordered
Contributor · added in 1.2.0
Author of internal scale_x_reordered
Releases (10)

Pick two releases to compare their code metrics.

  • 1.6.2Latest
    record
    2026-04-29 · current release · diff ↗ ·
    removed 5 exports
    embed_cat_prop_plot, embed_cat_table, embed_chr_table_html, tabular_read, tabular_write
    added 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
  • R
    R 4.6.0 released · 2026-04-24
  • 1.6.1
    record
    2026-01-28 · diff ↗
  • 1.6.0
    record
    2025-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.4
    record
    2025-06-04 · diff ↗
  • 1.5.3
    record
    2025-06-02 · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • 1.5.1
    record
    2025-02-12 · diff ↗
  • 1.5.0
    record
    2025-01-10 · diff ↗ ·
    added 1 export
    girafe
  • 1.2.0
    record
    2024-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 more
    added 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
  • R
    R 4.4.0 released · 2024-04-24
  • 1.0.4
    record
    2024-02-29 · diff ↗
  • 1.0.1
    record
    2024-01-26
  • R
    R 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.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for saros version 1.6.2 [Data set]. HJJB, LLC. Data release v2026-10-26. https://doi.org/10.5281/zenodo.21843040

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.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy