TxpTransFuncList-class {toxpiR}R Documentation

List of TxpTransFunc objects

Description

Extension of S4Vectors::SimpleList that holds only NULL or TxpTransFunc objects.

Usage

TxpTransFuncList(...)

as.TxpTransFuncList(x)

Arguments

...

TxpTransFunc object or function to create TxpTransFuncList object

x

list, function, or TxpTransFunc object to coerce to TxpTransFuncList

Details

When ... includes function objects, TxpTransFuncList will attempt to coerce them to TxpTransFunc and return an error if any of the elements cannot be coerced to TxpTransFunc.

Examples

## Create TxpTransFunc objects
tf1 <- TxpTransFunc(function(x) x)
tf2 <- TxpTransFunc(function(x) sqrt(x))

## Create TxpTransFuncList 
tfl <- TxpTransFuncList(linear = tf1, sqrt = tf2, cube = function(x) x^3)
tfl[[3]](3) == 27
tfl[["sqrt"]](4) == 2

## Concatenate
c(tfl, tfl)

## names
names(c(tfl, tfl))

# note: names are printed as '' when missing; NULL is printed when list item
# is NULL
names(TxpTransFuncList(function(x) x, NULL))
TxpTransFuncList(function(x) x, NULL)

## coercion
as(function(x) x, "TxpTransFuncList")
as.TxpTransFuncList(function(x) x)

as(TxpTransFunc(function(x) x), "TxpTransFuncList")
as.TxpTransFuncList(TxpTransFunc(function(x) x))

as(list(function(x) x, sqrt = function(x) sqrt(x)), "TxpTransFuncList")
as.TxpTransFuncList(list(function(x) x, sqrt = function(x) sqrt(x)))

[Package toxpiR version 1.2.1 Index]