Skip to contents

Computes Pearson's correlation matrix with p-values

Usage

corr_coef(data, ..., verbose = TRUE)

Arguments

data

The data set.

...

Variables to use in the correlation. If no variable is informed all the numeric variables from data are used.

verbose

Logical argument. If verbose = FALSE the code is run silently.

Value

A list with the correlation coefficients and p-values

Author

Tiago Olivoto tiagoolivoto@gmail.com

Examples

# \donttest{
library(metan)

# All numeric variables
all <- corr_coef(data_ge2)

# Select variables
sel <- corr_coef(data_ge2, EP, EL, CD, CL)
print(sel)
#> ---------------------------------------------------------------------------
#> Pearson's correlation coefficient
#> ---------------------------------------------------------------------------
#>       EP    EL    CD    CL
#> EP 1.000 0.263 0.175 0.391
#> EL 0.263 1.000 0.912 0.255
#> CD 0.175 0.912 1.000 0.300
#> CL 0.391 0.255 0.300 1.000
#> ---------------------------------------------------------------------------
#> p-values for the correlation coefficients
#> ---------------------------------------------------------------------------
#>          EP       EL       CD       CL
#> EP 0.00e+00 8.92e-04 2.88e-02 4.55e-07
#> EL 8.92e-04 0.00e+00 1.97e-61 1.29e-03
#> CD 2.88e-02 1.97e-61 0.00e+00 1.39e-04
#> CL 4.55e-07 1.29e-03 1.39e-04 0.00e+00
#> 
#> 
#> 
# }