corr_rm: Filter Data Frame by Correlation Values

View source: R/corr_rm.R

corr_rmR Documentation

Filter Data Frame by Correlation Values

Description

Remove highly correlated variables from a data frame using the correlation functions' outputs and the findCorrelation function from the caret package.

Usage

corr_rm(df, c, ...)

## S3 method for class 'clist'
corr_rm(
  df,
  c,
  col = c("infer.value", "stat.value"),
  isig = TRUE,
  cutoff = 0.75,
  ...
)

## S3 method for class 'list'
corr_rm(
  df,
  c,
  col = c("infer.value", "stat.value"),
  isig = TRUE,
  cutoff = 0.75,
  ...
)

## S3 method for class 'cmatrix'
corr_rm(df, c, cutoff = 0.75, ...)

## S3 method for class 'matrix'
corr_rm(df, c, cutoff = 0.75, ...)

Arguments

df

[data.frame(1)]
The input data frame.

c

[clist(1) | cmatrix]
A correlation list output from the corrp function (with class clist), or a correlation matrix output from the corr_matrix function (with class cmatrix).

...

Additional arguments.

col

[character(1)]
The column to be used in the correlation matrix.

isig

[logical(1)]
Whether values that are not statistically significant should be represented by NA or FALSE in the correlation matrix.

cutoff

[numeric(1)]
A numeric value for the pairwise absolute correlation cutoff. The default value is 0.75.

Author(s)

Igor D.S. Siciliani, Paulo H. dos Santos

Examples


iris_clist <- corrp(iris)
iris_cmatrix <- corr_matrix(iris_clist)
corr_rm(df = iris, c = iris_clist, cutoff = 0.75, col = "infer.value", isig = FALSE)
corr_rm(df = iris, c = iris_cmatrix, cutoff = 0.75, col = "infer.value", isig = FALSE)


meantrix/corrp documentation built on April 17, 2025, 7:22 p.m.