View source: R/bettrGetReady.R
bettrGetReady | R Documentation |
Prepare input data for plotting with bettr. This function replicates the steps that are performed in the shiny app.
bettrGetReady(
df,
idCol = "Method",
metrics = setdiff(colnames(df), idCol),
initialWeights = NULL,
initialTransforms = list(),
metricInfo = NULL,
metricColors = NULL,
idInfo = NULL,
idColors = NULL,
scoreMethod = "weighted mean",
idOrdering = "high-to-low",
showOnlyTopIds = FALSE,
nbrTopIds = 10,
idTopNGrouping = NULL,
keepIds = NULL,
metricGrouping = NULL,
metricCollapseGroup = FALSE,
metricCollapseMethod = "mean",
bettrSE = NULL
)
df |
A |
idCol |
Character scalar, indicating the name of the column of |
metrics |
Character vector, indicating which of the
columns of |
initialWeights |
Named numeric vector providing initial weights for
each metric to use for aggregating them into a final score. Must contain
one entry per metric included in |
initialTransforms |
Named list with initial values of transformation parameters for each metric. Each list entry should correspond to one metric, and take the form of a list with up to four elements, named: * **flip**: Logical scalar; whether or not to flip the sign of the metric values. Defaults to `FALSE`. * **offset**: Numeric scalar; offset to add to the (flipped) metric values. Defaults to `0`. * **transform**: Character scalar; one of 'None', 'z-score', '\[0,1\]', '\[-1,1\]', 'Rank', 'Rank+\[0,1\]' or 'z-score+\[0,1\]', indicating which transform to apply to the metric values (after any flipping and/or adding the offset). Defaults to 'None'. * **cuts**: Numeric vector or `NULL`; the cut points that will be used to bin the metric values (after the other transformations). Defaults to `NULL`. Only values deviating from the defaults need to be explicitly specified, the others will be initialized to their default values. |
metricInfo |
|
metricColors |
Named list with colors used for columns of
|
idInfo |
|
idColors |
Named list with colors used for columns of |
scoreMethod |
Character scalar specifying the scoring method, that is,
how to aggregate scores across metrics. Should be one of
|
idOrdering |
Character scalar indicating whether methods should be
ranked with highest aggregated scores on top ( |
showOnlyTopIds |
Logical scalar indicating whether to only retain the top N methods (ranked by the aggregated score). |
nbrTopIds |
If |
idTopNGrouping |
If |
keepIds |
Character vector indicating which methods (a subset of the
values in |
metricGrouping |
A character scalar providing the name of a column in
|
metricCollapseGroup |
A logical scalar indicating whether metric
values should be collapsed within each group defined by
|
metricCollapseMethod |
If |
bettrSE |
A |
A list of objects, which can be directly used as inputs for the bettr plotting functions. See the man page for the respective plotting function for more details.
Charlotte Soneson
## Generate example data
df <- data.frame(Method = c("M1", "M2", "M3"),
metric1 = c(1, 2, 3),
metric2 = c(3, 1, 2))
metricInfo <- data.frame(Metric = c("metric1", "metric2", "metric3"),
Group = c("G1", "G2", "G2"))
idInfo <- data.frame(Method = c("M1", "M2", "M3"),
Type = c("T1", "T1", "T2"))
prepData <- bettrGetReady(df = df, idCol = "Method",
metricInfo = metricInfo, idInfo = idInfo)
prepData <- bettrGetReady(df = df, idCol = "Method",
metricInfo = metricInfo, idInfo = idInfo,
metricGrouping = "Group",
metricCollapseGroup = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.