Generates fast results tables, either attached to the coin or as a data frame.
get_results(
coin,
dset,
tab_type = "Summ",
also_get = NULL,
use = "scores",
order_by = NULL,
nround = 2,
use_group = NULL,
dset_indicators = NULL,
out2 = "df"
)
If out2 = "df"
, the results table is returned as a data frame. If out2 = "coin"
, this function returns an updated
coin with the results table attached to .$Results
.
The coin object, or a data frame of indicator data
Name of data set in .$Data
The type of table to generate. Either "Summ"
(a single indicator plus rank), "Aggs"
(all aggregated
scores/ranks above indicator level), or "Full"
(all scores/ranks plus all group, denominator columns).
Names of further columns to attach to table.
Either "scores"
(default), "ranks"
, or "groupranks"
. For the latter, use_group
must be specified.
A code of the indicator or aggregate to sort the table by. If not specified, defaults to the highest
aggregate level, i.e. the index in most cases. If use_group
is specified, rows will also be sorted by the specified group.
The number of decimal places to round numerical values to. Defaults to 2.
An optional grouping variable. If specified, the results table includes this group column,
and if use = "groupranks"
, ranks will be returned with respect to the groups in this column.
Optional data set from which to take only indicator (level 1) data from. This can be set to "Raw"
for example, so that all aggregates come from the aggregated data set, and the indicators come from the raw data set. This
can make more sense in presenting results in many cases, so that the "real" indicator data is visible.
If "df"
, outputs a data frame (tibble). Else if "coin"
attaches to .$Results
in an updated coin.
Although results are available in a coin in .$Data
, the format makes it difficult to quickly present results. This function
generates results tables that are suitable for immediate presentation, i.e. sorted by index or other indicators, and only including
relevant columns. Scores are also rounded by default, and there is the option to present scores or ranks.
See also vignette("results")
for more info.
This function replaces the now-defunct getResults()
from COINr < v1.0.
# build full example coin
coin <- build_example_coin(quietly = TRUE)
# get results table
df_results <- get_results(coin, dset = "Aggregated", tab_type = "Aggs")
head(df_results)
Run the code above in your browser using DataLab