The Vector class supports the storage of global and element-wise metadata:
metadata
accessor and
is represented as an ordinary list;mcols
accessor (mcols
stands formetadata columns) and
is represented as aDataTableobject (i.e. as an instance
of a concrete subclass ofDataTable, e.g. aDataFrameobject), with a row for each element
and a column for each metadata variable. Note that the element-wise
metadata can also beNULL
. To be functional, a class that inherits from Vector must define at
least a length
and a "["
method.
Displaying of a Vector object is controlled by 2 internal helpers,
classNameForDisplay
and showAsCell
.
For most objects classNameForDisplay(x)
just returns class(x)
.
However, for some objects it can return the name of a parent class that is
more suitable for display because it's simpler and as informative as the
real class name. See SimpleList objects (defined in this package)
and CompressedList objects (defined in the classNameForDisplay
returns the name of a parent class.
showAsCell(x)
produces a character vector parallel to
x
(i.e. with one string per vector element in x
) that
contains compact string representations of each elements in x
.
Note that classNameForDisplay
and showAsCell
are generic
functions so developers can implement methods to control how their own
Vector extension gets displayed.
mcols
accessor.showClass("Vector") # shows (some of) the known subclasses
Run the code above in your browser using DataCamp Workspace