From b48e6bb30d2e9f72a29b8a45840b2f8f51100284 Mon Sep 17 00:00:00 2001 From: Dominique Makowski Date: Thu, 26 Dec 2024 10:19:34 +0000 Subject: [PATCH] also sort attributes! --- R/cor_sort.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/cor_sort.R b/R/cor_sort.R index 1d550bdc..171daddd 100644 --- a/R/cor_sort.R +++ b/R/cor_sort.R @@ -76,6 +76,13 @@ cor_sort.easycormatrix <- function(x, distance = "correlation", hclust_method = attributes(reordered) ) + # Reorder attributes (p-values) etc. + for(id in c("p", "CI", "CI_low", "CI_high", "BF", "Method", "n_Obs", "df_error", "t")) { + if(id %in% names(attributes(reordered))) { + attributes(reordered)[[id]] <- attributes(reordered)[[id]][order(x$Parameter), names(reordered)] + } + } + # make sure Parameter columns are character reordered$Parameter <- as.character(reordered$Parameter)