matrixCorr-internal: Validation and normalisation for correlation

matrixCorr-internalR Documentation

Validation and normalisation for correlation

Description

Validates and normalises input for correlation computations. Accepts either a numeric matrix or a data frame, filters numeric columns, checks dimensions and (optionally) missing values, and returns a numeric (double) matrix with preserved column names.

Usage

validate_corr_input(data, check_na = TRUE)

Arguments

data

A matrix or data frame. Non-numeric columns are dropped (data.frame path). For matrix input, storage mode must be integer or double.

check_na

Logical (default TRUE). If TRUE, validate and reject inputs containing NA/NaN/Inf. Set to FALSE when an upstream routine (e.g., pairwise-complete kernels) will handle missingness per pair.

Details

Rules enforced:

  • Input must be a matrix or data.frame.

  • Only numeric (integer or double) columns are retained (data.frame path).

  • At least two numeric columns are required.

  • All columns must have the same length and \ge 2 observations.

  • Missing values are not allowed when check_na = TRUE.

  • Returns a double matrix; integer input is converted once.

Value

A numeric matrix (type double) with column names preserved.

Author(s)

Thiago de Paula Oliveira

See Also

pearson_corr(), spearman_rho(), kendall_tau()


matrixCorr documentation built on April 18, 2026, 5:06 p.m.