require(container) knitr::opts_chunk$set( collapse = TRUE, comment = "#", prompt = F, fig.path = "images/README-", tidy = FALSE, cache = FALSE, out.width = "100%" ) old <- options(width = 100L)
container
provides an enhanced version of base R's list
with a
carefully designed set of extract, replace, and remove operations that make
it easier and safer to work with list-like data structures.
container
?NULL
)In addition, this package provides specialized data structures Deque,
Set and Dict and a special class dict.table
, designed to extend
data.table by
container operations to safely
Manage data columns with dict.table.
# Install release version from CRAN install.packages("container") # Install development version from GitHub devtools::install_github("rpahl/container")
library(container) co <- container(colors = c("Red", "Green"), numbers = c(1, 2, 3), data = cars) co
Safe extract
at(co, "colours") # oops at(co, "colors")
Safe remove
co <- delete_at(co, "colours") # oops co <- delete_at(co, "colors") co
Flexible peek
at(co, "colors") # oops peek_at(co, "colors") peek_at(co, "colors", .default = c("black", "white"))
Safe replace
co <- replace_at(co, num = 1:10) # oops co <- replace_at(co, numbers = 1:10) co
options(old)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.