Launch bettr app to explore and aggregate performance metrics
Usage
bettr(
df = NULL,
idCol = "Method",
metrics = if (!is.null(df)) setdiff(colnames(df), idCol) else NULL,
initialWeights = NULL,
initialTransforms = list(),
metricInfo = NULL,
metricColors = NULL,
idInfo = NULL,
idColors = NULL,
weightResolution = 0.05,
bstheme = "darkly",
appTitle = "bettr",
bettrSE = NULL,
addStopButton = TRUE,
defaultWeight = 0.2,
serverMode = FALSE,
cacheVersion = NULL
)Arguments
- df
A
data.framein wide format. Should contain one column with the IDs of the entities to be compared, and one column for each metric to use for the comparison.- idCol
Character scalar, indicating the name of the column of
dfand/oridInfothat contains IDs of the entities to be compared (e.g., methods).- metrics
Character vector, indicating which of the columns of
dfthat correspond to metrics of interest. Only metrics included here will be displayed.- 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
metrics.- 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
data.framewith annotations for metrics. Must have a column named 'Metric' identifying the respective metrics.- metricColors
Named list with colors used for columns of
metricInfo. Should follow the format required for ComplexHeatmap heatmap annotations. The list can include an entry named 'Metric', which contains a named vector with colors to use for metrics.- idInfo
data.framewith annotations for entities. Must have a column named according toidColidentifying the respective entities.- idColors
Named list with colors used for columns of
idInfo. Should follow the format required for ComplexHeatmap heatmap annotations. The list can include an entry named according toidCol, which contains a named vector with colors to use for entities.- weightResolution
Numeric scalar in (0,1), giving the resolution at which weights can be specified using the sliders in the interface.
- bstheme
Character scalar giving the bootswatch theme for the app (see https://bootswatch.com/). Default 'darkly'.
- appTitle
Character scalar giving the title that will be used for the app. Defaults to 'bettr'.
- bettrSE
A
SummarizedExperimentgenerated byassembleSE. If this is notNULL,df,metrics,initialWeights,initialTransforms,metricInfo,metricColors,idInfoandidColorsarguments will be ignored and the information will be extracted from theSummarizedExperimentobject.Logical scalar. If
TRUE(default), will add a button to stop the app (by callingshiny::stopApp).- defaultWeight
Numeric scalar between 0 and 1, giving the default weight to assign to each metric.
- serverMode
Logical scalar. If
TRUE, launches the app in server mode where users can upload JSON files (in bettr format). IfFALSE(default), requires data to be provided via thedforbettrSEparameter.- cacheVersion
Character string or
NULL(default). A version identifier for the browser cache. When specified, cached data from previous versions will be automatically invalidated. Useful for forcing cache refresh when deploying updates. Examples: "v1.0", "2024-01-15", or any string.
Examples
df <- data.frame(Method = c("M1", "M2", "M3"), metric1 = c(1, 2, 3),
metric2 = c(3, 1, 2), metric3 = factor(c("a", "a", "b")))
initialTransforms <- list(metric1 = list(flip = TRUE, offset = 4))
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"))
metricColors <- list(Group = c(G1 = "red", G2 = "blue"))
if (interactive()) {
bettr(df = df, idCol = "Method",
metrics = c("metric1", "metric2", "metric3"),
initialTransforms = initialTransforms,
metricInfo = metricInfo, metricColors = metricColors,
idInfo = idInfo)
}