Skip to content

Commit 2fa3add

Browse files
committed
nicer printout for identical_cols
1 parent 3fc7650 commit 2fa3add

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

R/basefunctions.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,9 @@ identical_cols <- function(df,
644644
duplicated_groups <- unique(identical.cols[purrr::map_lgl(identical.cols, ~ length(.x) > 1)])
645645

646646
if (print_duplicates) {
647-
print(duplicated_groups)
647+
purrr::map(duplicated_groups,~paste(bt(.x), collapse = "\n")) |>
648+
paste(collapse = "\n\n") |>
649+
cat()
648650
}
649651

650652
if (remove_duplicates) {
@@ -654,7 +656,7 @@ identical_cols <- function(df,
654656
} else{
655657
user_choice = "a"
656658
}
657-
if (user_choice == "a") {
659+
if(user_choice == "a") {
658660
cols_to_remove <- col_names[col_names %in% unlist(
659661
purrr::map(duplicated_groups, ~ .x[-1])
660662
)]
@@ -663,14 +665,14 @@ identical_cols <- function(df,
663665
purrr::map(duplicated_groups, ~ .x[-1])
664666
)]
665667
df <- df[, cols_to_keep, drop = FALSE]
666-
if (clean_names) {
668+
if(clean_names) {
667669
df <- rename_with(
668670
df,
669671
.cols = all_of(cols_to_keep),
670672
.fn = ~ str_remove(.x, "\\.{3}\\d+$")
671673
)
672674
}
673-
} else if (user_choice == "s") {
675+
} else if(user_choice == "s") {
674676
cn2rename <- ""
675677
cols_to_remove <- character(0)
676678
for (group in duplicated_groups) {

0 commit comments

Comments
 (0)