TypedList-class {geva} | R Documentation

## Type-strict List (TypedList-class)

### Description

List containing elements of the same class or inheritance.

### Value

A `TypedList` object

### Slots

`.Data`

  `list` of internal contents. Elements must match or inherit a common class
  (Inherited from `list`)

`elem.class`

  `character` representing the class related to the elements

### Methods

Constructors

`typed.list(..., elem.class = NA_character_)`

  Creates a TypedList from the elements in `...` derived from the class `elem.class`

Conversion and coercion

`as.list(x, ...)`

  Converts this object to `list`

`as.typed.list.list(x, elem.class = NA_character_)`

  Converts a `list` to a `TypedList` if its elements inherit the same type

`as.typed.list(x, elem.class = NA_character_)`

  Coerces a `TypedList` to support the inherited class indicated by `elem.class`

`as.typed.list.vector(x, elem.class = NA_character_)`

  Converts a vector to a `TypedList`

Properties

`x[i, j, ...] <- value`

  Sets a value to this list. The `value` argument must be compatible to the current list type

### Examples

    ## Creates a TypeList that stores list-derived objects
    tpls = typed.list(A=list(1L:5L),
                      B=data.frame(v1=LETTERS[1L:10L]),
                      elem.class = 'list')

    # Note: The 'elem.class' above is optional, since the
    # class is automatically detected from the first argument

[Package geva version 1.2.0 Index]