Read-Only Variable Bundles

Easily create list-like structures with constant, read-only variables. Combines the flexibility of lists with read-only fields. Supports defensive programming by throwing errors on field assignment, helping mitigate the introduction of logical runtime bugs.

Author: Brandon C. Loudermilk

Introduction: VarBundles support defensive programming by making it easy for R developers to bundle conceptually related read-only variables in a named, list-like object of unmutable constants.

thresholds <- varbundle(list(min = 1, max = 100))

# Read-only Access
thresholds$max #100
thresholds[["min"]] #1

# Assignment throws error
thresholds$min <- 25 # VarBundle fields are read only.

# Cannot create new fields after object creation
thesholds$foo <- 10 # Cannot add new fields to VarBundle

The quickest way to learn about {VarBundle} is to install the package and read the vignette.

browseVignettes(package = "VarBundle")


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.0 by Brandon C. Loudermilk, 3 years ago

Browse source code at

Authors: Brandon C. Loudermilk

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports R6, glue, tibble, magrittr, dplyr, stringr, crayon

Suggests testthat, purrr, knitr, rmarkdown, readr

See at CRAN