getCorrDf: Obtain correlation data.frame

getCorrDfR Documentation

Obtain correlation data.frame

Description

Extracts correlation results in form of a data.frame that has been constructed by melting a correlation matrix and its corresponding p-values to a data.frame via reshape2::melt().

Usage

getCorrDf(object, ...)

## S4 method for signature 'Correlation'
getCorrDf(
  object,
  method_corr = "pearson",
  across = NULL,
  across_subset = NULL,
  pval_threshold = 0.05,
  type = "complete",
  diagonal = TRUE,
  distinct = FALSE,
  digits = 2,
  verbose = TRUE,
  sep = " & ",
  ...
)

## S4 method for signature 'Analysis'
getCorrDf(
  object,
  method_corr = "pearson",
  across = NULL,
  across_subset = NULL,
  pval_threshold = 0.05,
  type = "complete",
  diagonal = TRUE,
  distinct = FALSE,
  digits = 2,
  verbose = TRUE,
  sep = " & ",
  ...
)

## S4 method for signature 'Analysis'
getCorrMtr(
  object,
  method_corr = "pearson",
  across = NULL,
  across_subset = NULL,
  type = "complete",
  diagonal = TRUE,
  flatten = TRUE
)

Arguments

object

Any object for whose class a method has been defined.

across

Character value. Specifies the discrete variable in the data.frame across which the variables of interest are to be analyzed or displayed.

pval_threshold

Numeric value or NULL. If numeric, denotes the maximum p-value to be considered as significant. Must no be higher than 0.05.

type

Character value. Denotes how the underlying correlation matrix is handled. Three options:

  • 'complete': The matrix stays as is.,

  • 'lower': The part below the diagonal is used. The upper part is set to NA.,

  • 'upper':The part above the diagonal is used. the lower part is set to NA.

diagonal

Logical value. Indicates if the diagonal values of the matrices are kept ( = TRUE) or set to NA (= FALSE). Ignored if type = 'complete'.

distinct

Logical value. If TRUE only one observation per variable pair remains in the output data.frame.

digits

Numeric. Given to base::round() and indicates the number of digits to which the correlation value is rounded. Defaults to 2.

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

sep

Character value. Denots the string with which the variable pairs are combined in variable var_pair of the output data.frame.

Value

A data.frame of class corr_df with the following columns:

  • across: Factor or NULL. If factor, the group names of the grouping variable denoted in across.,

  • var1: Factor. First variable of the correlated variable pair.

  • var2: Factor. Second variable of the correlated variable pair.,

  • var_pair:Factor. Combination of var1 and var2,

  • corr: Numeric. The correlation vaule.,

  • pval: Numeric. The corresponding p-value.,

  • emphpval_threshold: Numeric. The denoted p-value threshold.,

  • signif: Logical. Indicates if the p-value of the correlated pair is below the denoted threshold.

  • method_corr: Character. The correlation method.


kueckelj/confuns documentation built on July 4, 2024, 4:53 p.m.