TxpResult-class | R Documentation |
S4 class to store ToxPi results
## 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'
txpMissing(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
)
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 |
txpScores(TxpResult)
: Return txpScores
slot
txpSliceScores(TxpResult)
: Return txpSliceScores
slot; default
adjusted = TRUE
, i.e. return slice scores adjusted for weight
txpRanks(TxpResult)
: Return txpRanks
slot
txpMissing(TxpResult)
: Return txpMissing
slot
txpResultParam(TxpResult)
: Return txpResultParam
slot
txpModel(TxpResult)
: Return txpModel
slot
txpIDs(TxpResult)
: Return txpIDs
slot
txpWeights(TxpResult)
: Return txpWeights
slot from model – shortcut
for txpWeights(txpModel(x))
; default adjusted = FALSE
, i.e. return
unadjusted weights
txpSlices(TxpResult)
: Return txpSlices
slot from model – shortcut
for txpSlices(txpModel(x))
txpTransFuncs(TxpResult)
: Return txpTransFuncs
slot from model –
shortcut for txpTransFuncs(txpModel(x))
txpValueNames(TxpResult)
: Return txpValueNames
slot from slices –
shortcut for txpValueNames(txpSlices(txpModel(x)))
length(TxpResult)
: Return the number of observations; shortcut for
length(txpScores(x))
sort(TxpResult)
: Sort the “TxpResult' object by their ranks
names(TxpResult)
: Returns IDs; equal to txpIDs(x)
as.data.frame(TxpResult)
: Coerce TxpResult to base::data.frame object
with IDs, scores, ranks, and slice scores
txpScores
vector(<numeric>)
of model scores
txpSliceScores
matrix(<numeric>)
, sample by slice matrix
with
individual slice scores
txpRanks
vector(<numeric>)
with rank of scores
txpMissing
vector(<numeric>)
with data missingness
txpModel
TxpModel object
txpIDs
vector(<character>)
of observation IDs
txpResultParam
TxpResultParam object
txpCalculateScores, plot, TxpResultList
## 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)
txpMissing(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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.