Virtual base mapping type for R6 objects; defines internal data structure
(private$.data
) as a named list along with behavior methods for
getting (self$get()
) and setting (self$set()
) items in the map
Usage
# S3 method for class 'MappingBase'
x[[i, ..., default = NULL]]
# S3 method for class 'MappingBase'
x[[i, ...]] <- value
# S3 method for class 'MappingBase'
as.list(x, ...)
# S3 method for class 'MappingBase'
length(x)
# S3 method for class 'MappingBase'
names(x)
Arguments
- x
A mapping object
- i
A key to fetch or set; see $get()
or $set()
methods below
- ...
Ignored
- default
Default value to fetch if i
is not found;
defaults to NULL
- value
Value to add for i
, or NULL
to remove
the entry for i
Value
[[
: The value of i
in the map, or default
if
i
is not found
[[<-
: x
with value
added as i
as.list
: The map as a list
length
: The number of items in the map
names
: The keys of the map
Methods
Method new()
Returns
This is a virtual class and cannot be directly instantiated
Method keys()
Returns
The keys of the map
Method values()
Returns
A list
containing the map values
Method items()
Returns
Return the items of the map as a list
Usage
MappingBase$get(key, default = quote(expr = ))
Arguments
key
Key to fetch
default
Default value to fetch if key
is not found;
defaults to NULL
Returns
The value of key
in the map, or default
if
key
is not found
Method set()
Usage
MappingBase$set(key, value)
Arguments
key
Key to set
value
Value to add for key
, or NULL
to remove
the entry for key
Returns
[chainable] Invisibly returns self
with
value
added as key
Method setv()
Arguments
...
Named arguments to add to self
Returns
[chainable] Invisibly returns self
with the values
of ...
added to the map
Returns
[chainable] Invisibly returns self
with key
removed from the map
Arguments
map
A mapping type to update the current map with
Returns
[chainable] Invisibly returns self
with the value
of map
Returns
The number of items in the map
Method to_list()
Returns
The map as a list
Returns
[chainable] Prints information about the map to stdout
and invisibly returns self
Method clone()
The objects of this class are cloneable with this method.
Usage
MappingBase$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.