TxpSlice-class | R Documentation |
S4 class to store ToxPi slices
TxpSlice(txpValueNames, txpTransFuncs = NULL)
## S4 method for signature 'TxpSlice'
txpValueNames(x)
## S4 replacement method for signature 'TxpSlice'
txpValueNames(x) <- value
## S4 method for signature 'TxpSlice'
txpTransFuncs(x)
## S4 replacement method for signature 'TxpSlice'
txpTransFuncs(x) <- value
## S4 method for signature 'TxpSlice'
length(x)
## S4 method for signature 'TxpSlice,TxpSlice'
merge(x, y)
txpValueNames |
Passed to |
txpTransFuncs |
Passed to |
x , y |
|
value |
Replacement value |
If the user supplies txpTransFuncs
a single function/TxpTransFunc object,
the given function will be recycled for each input with a warning.
txpValueNames(TxpSlice)
: Return txpValueNames
slot
txpTransFuncs(TxpSlice)
: Return txpTransFuncs
slot
length(TxpSlice)
: Return number of inputs in slice; shortcut for
length(txpValueNames(x))
merge(x = TxpSlice, y = TxpSlice)
: Merge two TxpSlice
objects into a single
slice
txpValueNames
vector(<character>)
specifying the input columns to
include in the slice
txpTransFuncs
TxpTransFuncList with one function per entry in
txpValueNames
or an object that can be coerced to TxpTransFuncList
;
when NULL
, no transformation function applied
## Create TxpSlice object
# Without transform functions
TxpSlice(txpValueNames = c("sqrData", "expData"))
# With transform functions
TxpSlice(txpValueNames = c("sqrData", "expData"),
txpTransFuncs = c(sq = function(x) x^2, log = function(x) log(x)))
# Transformation function recycled with warning when single function given
TxpSlice(txpValueNames = c("sqrData", "expData"),
txpTransFuncs = function(x) x^2)
## Access TxpSlice slots
sl <- TxpSlice(txpValueNames = c("sqrData", "expData"),
txpTransFuncs = c(sq = function(x) x^2,
log = function(x) log(x)))
txpValueNames(sl)
txpTransFuncs(sl)
## Replacement
txpValueNames(sl)[1] <- "hello"
sl
txpTransFuncs(sl)[[2]](exp(1))
txpTransFuncs(sl)[[2]] <- function(x) sqrt(x)
txpTransFuncs(sl)[[2]](exp(1))
# Note that replacing a single list element does NOT update the name
sl
names(txpTransFuncs(sl))[2] <- "sqrt"
sl
# Replacing the whole list DOES update the names
txpTransFuncs(sl) <- list(sqrt = function(x) sqrt(x),
log = function(x) log(x))
sl
## length -- returns number of inputs
length(TxpSlice(letters))
## merge
s1 <- TxpSlice("hello")
s2 <- TxpSlice("data")
merge(s1, s2)
# Note, input names still must be unique
## Not run: merge(s1, s1) ## produces error
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.