TxpSliceList-class: List of TxpSlice objects

TxpSliceList-classR Documentation

List of TxpSlice objects

Description

Extension of S4Vectors::SimpleList that requires uniquely-named elements and holds only TxpSlice objects.

Usage

TxpSliceList(...)

## S4 method for signature 'TxpSliceList'
txpValueNames(x, simplify = FALSE)

## S4 method for signature 'TxpSliceList'
txpTransFuncs(x, simplify = FALSE)

## S4 method for signature 'TxpSliceList'
duplicated(x)

as.TxpSliceList(x)

Arguments

...

TxpSlice object to create TxpSliceList object; MUST give unique names to each slice

x

TxpSliceList object

simplify

Scalar logical, when TRUE the returned list is simplified to a vector/TxpTransFuncList object

Details

Note, there is no coercion for TxpSlice to TxpSliceList because unique names are required.

Functions

  • txpValueNames(TxpSliceList): Return list of txpValueNames slots for the contained TxpSlice objects, or vector when simplify = TRUE

  • txpTransFuncs(TxpSliceList): Return list of txpTransFuncs slots for the contained TxpSlice objects, or TxpTransFuncList when simplify = TRUE

  • duplicated(TxpSliceList): Returns logical vector of length(x), where TRUE indicates a duplicate slice in the list; see base::duplicated

Examples

## Create TxpSlice objects
s1 <- TxpSlice("input1", list(linear = function(x) x))
s2 <- TxpSlice(c("input2", "input3"), 
               list(log = function(x) log(x), sqrt = function(x) sqrt(x)))

## Create TxpSliceList
sl <- TxpSliceList(s1 = s1, s2 = s2)

## Accessors
txpValueNames(sl)
txpValueNames(sl, simplify = TRUE)

txpTransFuncs(sl)
txpTransFuncs(sl, simplify = TRUE)

## Coercion
as(list(s1 = TxpSlice("hello"), s2 = TxpSlice("user")), "TxpSliceList")
as.TxpSliceList(c(s1 = TxpSlice("hello"), s2 = TxpSlice("user")))

## Concatenation
c(sl, TxpSliceList(s3 = TxpSlice("input4")))

## Reduce TxpSliceList to single slice
Reduce(merge, sl)

ToxPi/toxpiR documentation built on Sept. 4, 2024, 5:55 p.m.