compare_coins {COINr}R Documentation

Compare two coins

Description

Compares two coin class objects using a specified iCode (column of data) from specified data sets.

Usage

compare_coins(
  coin1,
  coin2,
  dset,
  iCode,
  also_get = NULL,
  compare_by = "ranks",
  sort_by = NULL,
  decreasing = FALSE
)

Arguments

coin1

A coin class object

coin2

A coin class object

dset

A data set that is found in .$Data.

iCode

The name of a column that is found in .$Data[[dset]].

also_get

Optional metadata columns to attach to the table: see get_data().

compare_by

Either "ranks" which produces a comparison using ranks, or else "scores", which instead uses scores. Note that scores may be very different if the methodology is different from one coin to another, e.g. for different normalisation methods.

sort_by

Optionally, a column name of the output data frame to sort rows by. Can be either "coin.1", "coin.2", "Diff", "Abs.diff" or possibly a column name imported using also_get.

decreasing

Argument to pass to order(): how to sort.

Details

This function replaces the now-defunct compTable() from COINr < v1.0.

Value

A data frame of comparison information.

Examples

# build full example coin
coin <- build_example_coin(quietly = TRUE)

# copy coin
coin2 <- coin

# change to prank function (percentile ranks)
# we don't need to specify any additional parameters (f_n_para) here
coin2$Log$Normalise$global_specs <- list(f_n = "n_prank")

# regenerate
coin2 <- Regen(coin2)

# compare index, sort by absolute rank difference
compare_coins(coin, coin2, dset = "Aggregated", iCode = "Index",
              sort_by = "Abs.diff", decreasing = TRUE)


[Package COINr version 1.1.7 Index]