HList-class: Homogenous lists

Description Usage Arguments Slots Extends Methods See Also Examples

Description

An S4 subclass of list in which all elements of the list to be the same class. This is similar to the 'atomic lists' in R in that all elements of the vector must be the same class, but the HList supports arbitrary classes. NULL values are also valid.

Usage

1
  HList(x, classtype = "ANY", ...)

Arguments

x

list.

classtype

character

...

Data to include in the new object. Named arguments correspond to slots in the class definition.

Slots

.Data

Object of class list.

classtype

character. Required classtype for all elements in the list.

empty_names

logical. If FALSE, then no names can be NA or "".

unique_names

logical. If TRUE, then no duplicate names are allowed.

Extends

list

Directly.

Methods

[<-

signature(x = "HList")

[

signature(x = "HList")

[[<-

signature(x = "HList")

c

signature(x = "HList")

show

signature(object = "HList")

See Also

hlist_class,

Examples

1
2
3
4
5
6
7
# This is valid with lists
foo <- list(a=1:10, b=c(1, 5))
foo[["c"]] <- c("a", "z")
# # But would not be valid with a homogenous list
foo <- HList(list(a=1:10, b=c(1, 5)), "numeric")
try(foo[["c"]] <- c("a", "z"))
foo[["c"]] <- c(1, 4, 10)

jrnold/r-checker documentation built on May 20, 2019, 1:04 a.m.