knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
library(glue)

VarBundle

knitr::include_graphics("inst/images/varbundle.png")


VarBundle supports defensive programming by making it easy for R developers to bundle conceptually related read-only variables in a named, list-like object of immutable constants. 

## Installation  

```r
# Install the released version from CRAN:
install.packages("VarBundle")

# Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("loudermilk/VarBundle")

Usage

VarBundle fields can be accessed like lists.
library(VarBundle)
thresholds <- varbundle(list(min = 1, max = 100))

# Read-only Access
thresholds$max #100
thresholds[["min"]] #1
But fields are read-only and new fields cannot be added after object creation.
# 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 read the vignette.
browseVignettes(package = "VarBundle")

Getting Help

If you have a question, encounter a bug (or typo), or have a feature request, please submit an issue on GitHub.



loudermilk/VarBundle documentation built on May 27, 2019, 3:31 p.m.