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.
# Install the released version from CRAN:
install.packages("VarBundle")
# Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("loudermilk/VarBundle")
library(VarBundle)
thresholds <- varbundle(list(min = 1, max = 100))
# Read-only Access
thresholds$max #100
#> [1] 100
thresholds[["min"]] #1
#> [1] 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
browseVignettes(package = "VarBundle")
#> starting httpd help server ... done
If you have a question, encounter a bug (or typo), or have a feature request, please submit an issue on GitHub.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.