From 2af1634709b4f009ec1e794e19073764a23b53c3 Mon Sep 17 00:00:00 2001 From: paulo Date: Thu, 9 Jan 2025 11:45:24 -0300 Subject: [PATCH] General comments for review #27 export corrplot and update readme --- NAMESPACE | 1 + R/acca.R | 1 + R/corr_matrix.R | 2 +- R/corrp.R | 2 +- README.md | 15 ++++++++++++++- man/corr_matrix.Rd | 2 +- man/corrp.Rd | 2 +- 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 87fa870..a5d244a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -23,4 +23,5 @@ export(ptest) export(sil_acca) importFrom(Rcpp,evalCpp) importFrom(RcppArmadillo,armadillo_version) +importFrom(corrplot,corrplot) useDynLib(corrp, .registration=TRUE) diff --git a/R/acca.R b/R/acca.R index 3872884..2e206f1 100644 --- a/R/acca.R +++ b/R/acca.R @@ -1,6 +1,7 @@ #' @useDynLib corrp, .registration=TRUE #' @importFrom Rcpp evalCpp #' @importFrom RcppArmadillo armadillo_version +#' @importFrom corrplot corrplot #' @title Average correlation clustering algorithm #' diff --git a/R/corr_matrix.R b/R/corr_matrix.R index 8248902..ba58fd7 100644 --- a/R/corr_matrix.R +++ b/R/corr_matrix.R @@ -17,7 +17,7 @@ #' #' iris_cor <- corrp(iris) #' iris_m <- corr_matrix(iris_cor, isig = FALSE) -#' corrplot::corrplot(iris_m) +#' corrplot(iris_m) #' @export corr_matrix <- function(c, ...) { UseMethod("corr_matrix", c) diff --git a/R/corrp.R b/R/corrp.R index 9915cb5..86ab8f4 100644 --- a/R/corrp.R +++ b/R/corrp.R @@ -94,7 +94,7 @@ #' @examples #' iris_c <- corrp(iris) #' iris_m <- corr_matrix(iris_c, isig = FALSE) -#' corrplot::corrplot(iris_m) +#' corrplot(iris_m) #' #' #' @export diff --git a/README.md b/README.md index 2b4166e..da6de70 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,10 @@ remotes::install_github("meantrix/corrp@main") `corrp` Next, we calculate the correlations for the data set iris using: Maximal Information Coefficient for numeric pair, the Power Predictive Score algorithm for numeric/categorical pair and Uncertainty coefficient for categorical pair. ```r -results = corrp::corrp(iris, cor.nn = 'mic',cor.nc = 'pps',cor.cc = 'uncoef', n.cores = 2 , verbose = FALSE) +# coorp with using iris using parallel processing +results = corrp::corrp(iris, cor.nn = 'mic', cor.nc = 'pps',cor.cc = 'uncoef', n.cores = 2 , verbose = FALSE) +# an sequential example with different correlation pair types +results_2 = corrp::corrp(mtcars, cor.nn = 'pps', cor.nc = 'lm', cor.cc = 'cramersV', verbose = FALSE) head(results$data) # infer infer.value stat stat.value isig msg varx vary @@ -76,6 +79,16 @@ head(results$data) # Predictive Power Score 0.5591864 F1_weighted 0.7028029 TRUE Sepal.Length Species # Maximal Information Coefficient 0.2770503 P-value 0.0000000 TRUE Sepal.Width Sepal.Length +head(results_2$data) + +# infer infer.value stat stat.value isig msg varx vary +# Predictive Power Score 1.0000000 NA TRUE mpg mpg +# Predictive Power Score 0.3861810 MAE 0.8899206 TRUE mpg cyl +# Predictive Power Score 0.3141056 MAE 74.7816795 TRUE mpg disp +# Predictive Power Score 0.2311418 MAE 42.3961506 TRUE mpg hp +# Predictive Power Score 0.1646116 MAE 0.3992651 TRUE mpg drat +# Predictive Power Score 0.2075760 MAE 0.5768637 TRUE mpg wt + ``` `corr_matrix` Using the previous result we can create a correlation matrix as follows: diff --git a/man/corr_matrix.Rd b/man/corr_matrix.Rd index faeec6f..5901f1d 100644 --- a/man/corr_matrix.Rd +++ b/man/corr_matrix.Rd @@ -30,7 +30,7 @@ create a correlation matrix. iris_cor <- corrp(iris) iris_m <- corr_matrix(iris_cor, isig = FALSE) -corrplot::corrplot(iris_m) +corrplot(iris_m) } \author{ Igor D.S. Siciliani diff --git a/man/corrp.Rd b/man/corrp.Rd index 535cd5f..8c1b12c 100644 --- a/man/corrp.Rd +++ b/man/corrp.Rd @@ -130,7 +130,7 @@ categorical variable. \examples{ iris_c <- corrp(iris) iris_m <- corr_matrix(iris_c, isig = FALSE) - corrplot::corrplot(iris_m) + corrplot(iris_m) }