| ListLike-class {IRanges} | R Documentation |
The ListLike class is just an interface i.e. a virtual class with no slots.
ListLike subclasses (i.e. classes that contain the ListLike class)
must define the following minimal set of functions/operators:
length, "[[" and names.
Then, instances of these subclasses can be considered to have the shape
of a list, and the methods described below apply to them.
Some direct subclasses of the ListLike class are: Views, MaskCollection, XStringSet (defined in the Biostrings package), etc...
In the code snippets below, x and X are ListLike objects.
x$name:
Similar to x[[name]], but name is taken
literally as an element name.
lapply(X, FUN, ...):
Like the standard lapply function defined in the
base package, the lapply method for ListLike objects returns
a list of the same length as X, each element of
which is the result of applying FUN to the corresponding element
of X.
sapply(X, FUN, ..., simplify=TRUE, USE.NAMES=TRUE):
Like the standard sapply function defined in the
base package, the sapply method for ListLike objects
is a user-friendly version of lapply by default
returning a vector or matrix if appropriate.
as.list(x, ...):
Turns x into a standard list.
isEmpty(x):
Here x can be an atomic, list or ListLike object, or any
object for which an isEmpty method is defined.
If x is atomic, returns length(x) == 0L.
If x is a list or ListLike object, then it works
elementwise and is defined recursively by
sapply(x, function(xx) all(isEmpty(xx))).
H. Pages
Some direct subclasses of the ListLike class: TypedList-class, Views-class, MaskCollection-class, XStringSet-class.
showClass("ListLike") # shows (some of) the known subclasses