| TxpResult-class {toxpiR} | R Documentation |
ToxPi Result
Description
S4 class to store ToxPi results
Usage
## S4 method for signature 'TxpResult'
txpScores(x)
## S4 method for signature 'TxpResult'
txpSliceScores(x, adjusted = TRUE)
## S4 method for signature 'TxpResult'
txpRanks(x)
## S4 method for signature 'TxpResult'
txpResultParam(x)
## S4 method for signature 'TxpResult'
txpModel(x)
## S4 method for signature 'TxpResult'
txpIDs(x)
## S4 replacement method for signature 'TxpResult'
txpIDs(x) <- value
## S4 method for signature 'TxpResult'
txpWeights(x, adjusted = FALSE)
## S4 method for signature 'TxpResult'
txpSlices(x)
## S4 method for signature 'TxpResult'
txpTransFuncs(x, level, simplify = FALSE)
## S4 method for signature 'TxpResult'
txpValueNames(x, simplify = FALSE)
## S4 method for signature 'TxpResult,logical,missing'
x[i, j, ..., drop = FALSE]
## S4 method for signature 'TxpResult,integer,missing'
x[i, j, ..., drop = FALSE]
## S4 method for signature 'TxpResult,numeric,missing'
x[i, j, ..., drop = FALSE]
## S4 method for signature 'TxpResult,character,missing'
x[i, j, ..., drop = FALSE]
## S4 method for signature 'TxpResult'
length(x)
## S4 method for signature 'TxpResult'
sort(x, decreasing = TRUE, na.last = TRUE, ...)
## S4 method for signature 'TxpResult'
names(x)
## S4 replacement method for signature 'TxpResult'
names(x) <- value
## S4 method for signature 'TxpResult'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
...,
id.name = "id",
score.name = "score",
rank.name = "rank",
adjusted = FALSE
)
Arguments
x |
TxpResult object |
adjusted |
Logical scalar, when |
value |
Replacement value |
level |
|
simplify |
Logical scalar, flatten |
i |
Subsetting index |
j, drop, optional |
Not currently implemented |
... |
Passed to base::data.frame in |
decreasing, na.last |
Passed to base::sort |
row.names |
Passed to base::data.frame |
id.name, score.name, rank.name |
Character scalar; when coercing to
base::data.frame, the name for the |
Functions
-
txpScores,TxpResult-method: ReturntxpScoresslot -
txpSliceScores,TxpResult-method: ReturntxpSliceScoresslot; defaultadjusted = TRUE, i.e. return slice scores adjusted for weight -
txpRanks,TxpResult-method: ReturntxpRanksslot -
txpResultParam,TxpResult-method: ReturntxpResultParamslot -
txpModel,TxpResult-method: ReturntxpModelslot -
txpIDs,TxpResult-method: ReturntxpIDsslot -
txpWeights,TxpResult-method: ReturntxpWeightsslot from model – shortcut fortxpWeights(txpModel(x)); defaultadjusted = FALSE, i.e. return unadjusted weights -
txpSlices,TxpResult-method: ReturntxpSlicesslot from model – shortcut fortxpSlices(txpModel(x)) -
txpTransFuncs,TxpResult-method: ReturntxpTransFuncsslot from model – shortcut fortxpTransFuncs(txpModel(x)) -
txpValueNames,TxpResult-method: ReturntxpValueNamesslot from slices – shortcut fortxpValueNames(txpSlices(txpModel(x))) -
length,TxpResult-method: Return the number of observations; shortcut forlength(txpScores(x)) -
sort,TxpResult-method: Sort the “TxpResult' object by their ranks -
names,TxpResult-method: Returns IDs; equal totxpIDs(x) -
as.data.frame,TxpResult-method: Coerce TxpResult to base::data.frame object with IDs, scores, ranks, and slice scores
Slots
txpScoresvector(<numeric>)of model scorestxpSliceScoresmatrix(<numeric>), sample by slicematrixwith individual slice scorestxpRanksvector(<numeric>)with rank of scorestxpModelTxpModel object
txpIDsvector(<character>)of observation IDstxpResultParamTxpResultParam object
See Also
txpCalculateScores, plot, TxpResultList
Examples
## Load example dataset & model; see ?TxpModel for building model objects
data(txp_example_input, package = "toxpiR")
data(txp_example_model, package = "toxpiR")
## Calculate scores for single model; returns TxpResult object
res <- txpCalculateScores(model = txp_example_model,
input = txp_example_input,
id.var = "name")
## Accessors
txpScores(res)
txpSliceScores(res) ## adjusted for weight, by default
apply(txpSliceScores(res), 2, max, na.rm = TRUE)
txpSliceScores(res, adjusted = FALSE) ## each score should have maximum of 1
apply(txpSliceScores(res, adjusted = FALSE), 2, max, na.rm = TRUE)
txpRanks(res)
txpModel(res)
identical(txpModel(res), txp_example_model)
txpIDs(res)
names(res) ## identical to txpIDs(res)
identical(txpIDs(res), names(res))
# Can access TxpModel slots directly
txpWeights(res)
txpWeights(res, adjusted = TRUE)
txpSlices(res)
# When retrieving transform functions, must specify level because both
# models and slices have transform functions
txpTransFuncs(res, level = "model")
# Can access TxpSliceList slots directly
txpValueNames(res)
txpValueNames(res, simplify = TRUE)
txpTransFuncs(res, level = "slices")
txpTransFuncs(res, level = "slices", simplify = TRUE)
## Subsetting
res[1]
res[c("chem01", "chem09")]
res[grepl("4|6", txpIDs(res))]
## Not run:
res[c(TRUE, FALSE)] ## gets recycled with warning
## End(Not run)
## length -- returns number of observations
length(res)
length(res[1:5])
## sort
names(res)
names(sort(res))
txpScores(res)
txpScores(sort(res))
txpScores(sort(res, decreasing = FALSE))
## as.data.frame
as.data.frame(res)
as.data.frame(res, id.name = "nm", score.name = "scr", rank.name = "rnk")