Stabilize Objects
Overview
A set of consistent, opinionated functions to quickly check objects, coerce them to the desired configuration, or deliver informative error messages when that is not possible.
Breaking changes
stabilize_present()is now namedassert_present(), since it doesn't stabilize (coerce) its input; it only asserts that the input is notNULL. Callingstabilize_present()now throws a "deprecated"-classed error directing you toassert_present()(#299).expect_pkg_error_snapshot(),expect_pkg_message_snapshot(), andexpect_pkg_warning_snapshot()now produce snapshots that mirrortestthat::expect_snapshot(), showing the bare expression underCodeand the condition class alongside its message (#301). Error messages for element-wise and incompatible-value failures also now list the failing locations and, where relevant, values, and the condition objects carry matchinglocationsandvalueselements (#274, #332). Existing snapshots of these messages must be re-accepted; usetestthat::skip_if_not_installed("stbl", minimum_version = "0.5.0")to skip such tests with older versions of{stbl}.
New features
- New assertion functions
assert_not()andassert_contains():assert_not()errors whenxwould be accepted (coerced or validated) by a singlespec, andassert_contains()checks that the number of elements matching aspecfalls within a given range (#289, #290). - New functions
ignore_stbl_error()andreplace_stbl_error()catch a{stbl}error of a givensubclass(defaulting to any{stbl}error).ignore_stbl_error()returnsNULL, allowing callers to suppress expected validation failures;replace_stbl_error()replaces the error's message with a custom one, with an optionaladditional_classargument to prepend extra classes to the error class list (#178, #334). - New "meta-stabilizer" functions compose other stabilizers and specs:
stabilize_all_of()requires every stabilizer in...to succeed,stabilize_any_of()returns the first successful result,stabilize_one_of()requires exactly one success, andstabilize_each()applies a single spec to every element. Matchingto_*()andspecify_*()variants are also available (#215, #278, #285, #286, #287, #288). - The
stabilize_*()andspecify_*()functions gain new constraint arguments:min_characters/max_charactersfor character vectors (#275),allowed_valuesto restrict input to a fixed set of permitted values (#282),exclusive_min_value/exclusive_max_valuefor strict numeric bounds (#276),multiple_ofto require values that are a multiple of a given value (#283), andunique/.uniqueto reject duplicate elements (#280). See each function's documentation for details. - New
date,dttm,time, anddurfunction families (to_date(),stabilize_date(),to_dttm(),stabilize_dttm(),to_time(),stabilize_time(),to_dur(),stabilize_dur(), plus matchingspecify_*()factories) validate and coerce RFC 3339 / ISO 8601 temporal values.stabilize_date()andstabilize_dttm()also accept unambiguous locale-dependent formats via a newaccepted_datetime_formatsargument and thelocale_datetime_formats()helper (#104, #105, #294, #295, #326). stabilize_df()andstabilize_lst()(and theirspecify_*()factories) are more flexible about named elements:.requiredmarks named specs as optional (#279),.extra_cols/.named/.unnamedacceptTRUEto allow extra or unnamed elements unchecked (#281), and.allow_zero_lengthlets a zero-length input skip the required-element check (#344).
Bug fixes
stabilize_lst()(andstabilize_df(), which delegates to it) now correctly detects missing required named elements even when.xhas no named elements at all, such aslist()orlist(1L, 2L). Previously, the required-element check was silently skipped whenever.xhad no named elements (#344).
Show all changes in 0.5.0Hide the rest of the changes in 0.5.0
to_chr(),to_dbl(),to_fct(),to_int(), andto_lgl()now throw an informative "incompatible values" error listing the failing locations and values when a list contains elements that can't be converted, instead of a generic "can't coerce" error (#273, #335).stabilize_*(NULL, allow_null = TRUE)always returnsNULL, without checking otherstabilize_*()rules. For example,stabilize_int(NULL, min_value = 1)now returnsNULL, rather than erroring (#353).
From NEWS.md in the release
Install
Health
- OK13 OK2026-10-15
- ERROR12 OK, 1 ERROR2026-10-14
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
Show 2 earlier changesHide 2 earlier changes
- ERROR12 OK, 1 ERROR2026-06-08
- OK14 OK2026-03-10
Documentation
- Help pages
- 237 (151 internal)includes a package overview page
- Examples that run
- 100%82 run in a plain check (3 of them under a condition)
- Exported functions with examples
- 92%
- Documented parameters
- 100%
- Return-value docs
- 98%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 98%
- Median days to close, 50 most recently updated closed issues
- 5
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
16 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/wranglezone/stbl on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-02 · The repository has a site deploy workflow
pkgdown site last built 2026-09-13
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-02-02Named in .Rbuildignore: .claude
- GitHub Copilotfirst seen 2026-03-18Seen in the repository: .github/copilot-instructions.md, .github/skills, .github/workflows/copilot-setup-steps.ymlPull request: opened by its own accountCommits: 25 by its own account · at least 24 crediting it in the message
- Copilot code reviewCommits: at least 8 accepting its review suggestions
Dependencies
Installing stbl adds 5 packages (4 with compiled code, 2.6 MB of source tarballs). Heaviest: vctrs 1.0 MB, rlang 766 KB, cli 629 KB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.5.0Latest2026-09-13 · current release · diff ↗ ·
added 68 exports
assert_contains, assert_not, assert_present, ignore_stbl_error, locale_datetime_formats, replace_stbl_error, specify_all_of, specify_any_of, specify_date, specify_date_scalar, specify_datetime, specify_datetime_scalar, specify_dttm, specify_dttm_scalar, specify_dur, specify_dur_scalar, specify_duration, specify_duration_scalar, specify_each, specify_one_of, specify_time, specify_time_scalar, stabilise_all_of, stabilise_any_of, stabilise_date, stabilise_date_scalar, stabilise_datetime, stabilise_datetime_scalar, stabilise_dttm, stabilise_dttm_scalar and 38 more - 0.4.02026-07-28 · diff ↗ ·
added 13 exports
are_fn_ish, are_function_ish, expect_pkg_message_classes, expect_pkg_message_snapshot, expect_pkg_warning_classes, expect_pkg_warning_snapshot, is_fn_ish, is_function_ish, pkg_inform, pkg_warn, to, to_fn, to_function - RR 4.6.0 released · 2026-04-24
- 0.3.02026-04-04 · diff ↗ ·
added 91 exports
!!, are_character_ish, are_double_ish, are_factor_ish, are_integer_ish, are_logical_ish, expect_pkg_error_classes, expect_pkg_error_snapshot, is_character_ish, is_double_ish, is_factor_ish, is_integer_ish, is_logical_ish, pkg_abort, specify_character, specify_character_scalar, specify_chr, specify_chr_scalar, specify_data_frame, specify_dbl, specify_dbl_scalar, specify_df, specify_double, specify_double_scalar, specify_factor, specify_factor_scalar, specify_fct, specify_fct_scalar, specify_int, specify_int_scalar and 61 more - 0.2.02025-09-16 · diff ↗ ·
added 16 exports
are_chr_ish, are_dbl_ish, are_fct_ish, are_int_ish, are_lgl_ish, is_chr_ish, is_dbl_ish, is_fct_ish, is_int_ish, is_lgl_ish, regex_must_match, regex_must_not_match, stabilize_dbl, stabilize_dbl_scalar, to_dbl, to_dbl_scalar - RR 4.5.0 released · 2025-04-11
- 0.1.12024-05-23
- RR 4.4.0 released · 2024-04-24
Package metadata
- First published
- 2024-05-23
- Total releases
- 5 / 2 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1
- Download size
- 845 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("stbl")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.