Pattern Matching and Enumerated Types in R
Overview
Inspired by pattern matching and enum types in Rust and many functional programming languages, this package offers an updated version of the 'switch' function called 'Match' that accepts atomic values, functions, expressions, and enum variants. Conditions and return expressions are separated by '->' and multiple conditions can be associated with the same return expression using '|'. 'Match' also includes support for 'fallthrough'. The package also replicates the Result and Option enums from Rust.
Install
Health
NOTERd filesr-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64, r-oldrel-macos-arm64, r-oldrel-macos-x86_64, r-oldrel-windows-x86_64, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-macos-arm64, r-release-macos-x86_64, r-release-windows-x86_64
checkRd: (-1) Match.Rd:90: Lost braces; missing escapes or markup?
90 | expression in braces. For example, the condition "{[ab]*}" is equivalent
| ^NOTECRAN incoming feasibilityr-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc
Maintainer: ‘Christopher Mann <cmann3@unl.edu>’
No Authors@R field in DESCRIPTION.
Please add one, modifying
Authors@R: person(given = "Christopher",
family = "Mann",
role = c("aut", "cre"),
email = "cmann3@unl.edu")
as necessary.- NOTE13 NOTENow
- NOTE14 NOTE2026-03-10
Documentation
- Help pages
- 27
- Examples that run
- 100%23 run in a plain check
- Exported functions with examples
- 96%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Dependencies
Installing matchr adds 1 package (1 with compiled code, 766 KB of source tarballs). Heaviest: rlang 766 KB.
Code & Tests
Datasets
People & History
- RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- RR 4.3.0 released · 2023-04-21
- RR 4.2.0 released · 2022-04-22
- 0.1.0Latest2021-09-09 · current release
- RR 4.1.0 released · 2021-05-18
Package metadata
- First published
- 2021-09-09
- Total releases
- 1 / 5 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.5.0
- Bundled data
- 4.9 KB / 3 files
- Download size
- 26 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("matchr")Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.