matrixCorr

R-CMD-check.yaml Codecov test coverage

matrixCorr is a lightweight, high-performance package for computing correlation matrices in R. Numerically robust estimates for:

Designed for large matrices and tie-heavy data, matrixCorr accepts matrices or data frames, returns symmetric correlation matrices with metadata, and includes convenient print() and plot() methods for quick inspection.

Features

Installation

# Install from GitHub
# install.packages("devtools")
devtools::install_github("Prof-ThiagoOliveira/matrixCorr")

Example

Kendall’s Tau Example

library(matrixCorr)

# Simulated data
set.seed(42)
mat <- cbind(A = rnorm(100), B = rnorm(100), C = rnorm(100))

# Compute Kendall's tau correlation matrix
ktau <- kendall_tau(mat)

# Print matrix
print(ktau)

# Visualize with ggplot2
plot(ktau)

Spearman’s Rho Example

library(matrixCorr)

# Simulated data with some ties
set.seed(123)
mat <- cbind(
  A = sample(1:10, 100, replace = TRUE),
  B = sample(1:10, 100, replace = TRUE),
  C = rnorm(100)
)

# Compute Spearman's rho correlation matrix
spearman <- spearman_rho(mat)

# Print matrix
print(spearman)

# Visualize with ggplot2
plot(spearman)

Pearson Correlation Example

library(matrixCorr)

# Simulated continuous data
set.seed(999)
mat <- cbind(
  A = rnorm(100),
  B = 0.5 * rnorm(100) + 0.5,
  C = runif(100)
)

# Compute Pearson correlation matrix
pcorr <- pearson_corr(mat)

# Print matrix
print(pcorr)

# Visualize with ggplot2
plot(pcorr)

License

MIT Thiago de Paula Oliveira

See inst/LICENSE for the full MIT license text.