Extraction ([.Container):
x[a:b],
x[1:c], x[d:2], and negative ranges like x[-(a:c)].list(...) sugar: x[1, "a", 3:5],
x[list(1, "a")].NA treated as FALSE with a warning..default argument supported to fill unknown/out-of-bounds positive indices
and unknown names while preserving order and duplicates.x[[TRUE]] now aligns with base R to return the first element.Replacement ([<-.Container):
x[] <- v targets all positions; zero-length selections perform no replacement.Operators & utilities:
%in% operator added (#36)..get_pos_indices and reused it
for replace to ensure consistent semantics.This update brings some big changes and breaks some of the earlier functions. However, with version 1.0.0, from now on, the API will remain stable.
All classes Container, Deque, Set and Dict now have been modified to
be more similar in the way elements can be added, extracted, replaced or
removed and therefore share most of their operations. The motivation behind this
was to provide specialized data structures that enhance base R list but at
the same time still 'feel' familiar to R users. As a result, all classes
(including Set and Dict) now provide named elements and access via name or
integer indices similar to base R list, which should users enable to use any of
them right from the start without having to read through the manual.
A new class dict.table is provided, a mixture of
data.table and Dict, which
extends data.table by Dict operations to enhance data column management.
List of changes
Set and Dict provide positional accessDict, internally all key-value pairs are stored in a hash-table and the
elements are always sorted lexicographically by their keysSet there is a new class OrderedSet, in which all elements
are also always sorted.name = value as is done in base R lists.add() now accepts multiple elements passed via name = value.delete() (formerly remove) and discard() now always work by value. For
removing elements by index, now delete_at() and discard_at() are used.has() now always works by value. For checking elements by name, now
has_name() is used.print() method has been fully revised and now (inspired by the
sets package) prints very compact.size() is now determined by length()count(), pop, and update are now available for all classesref_ are used.OrderedSet and dict.tablenames() is used to get and set the names as in base R list.[, [[, and $
operators using character or numeric indices or both at the same time.container_options() to customize printing and applied comparison operatorsunpack() to unpack nested container objectsreplace() and replace_at() to replace values and values at indicesat() and at2() for safe element extractionpeek_at() and peek_at2() for loose element peeking with default valuesref_pop() get and remove element at given indexrename() elements in placeempty() - use is_empty() insteadset() - use setnew() insteadsize() - use length() insteadsortkey() - keys of Dict objects are now always sortedremove() - use delete() insteadtype() - not of use anymorevalues() - use as.list() insteadInitial release