From f618f59a818be706b923ae65c8352c1c0de9462c Mon Sep 17 00:00:00 2001 From: Nicholas Masel <61123199+nicholas-masel@users.noreply.github.com> Date: Fri, 29 Mar 2024 08:28:54 -0400 Subject: [PATCH] Closes #218 modified row merge (#219) * modified row merge --- DESCRIPTION | 2 +- NAMESPACE | 1 + NEWS.md | 4 ++++ R/writer.R | 9 +++++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4d6156a..8ef0b88 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: logrx Title: A Logging Utility Focus on Clinical Trial Programming Workflows -Version: 0.3.0 +Version: 0.3.1 Authors@R: c( person(given = "Nathan", diff --git a/NAMESPACE b/NAMESPACE index ab37c1d..27b9290 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,6 +18,7 @@ importFrom(dplyr,group_by) importFrom(dplyr,mutate) importFrom(dplyr,rename_with) importFrom(dplyr,select) +importFrom(dplyr,summarize) importFrom(dplyr,ungroup) importFrom(magrittr,"%>%") importFrom(miniUI,gadgetTitleBar) diff --git a/NEWS.md b/NEWS.md index 97c8851..d2cc360 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,8 @@ +# logrx 0.3.1 + + - Hotfix to update used and unapproved packages and functions writing (#218) + # logrx 0.3.0 - Moved website theme to bootstrap 5, enabled search (#179) diff --git a/R/writer.R b/R/writer.R index 986c04a..059b4ce 100644 --- a/R/writer.R +++ b/R/writer.R @@ -142,6 +142,7 @@ write_masked_functions <- function(){ #' @return Formatted vector of used package functions #' @export #' +#' @importFrom dplyr summarize #' @importFrom purrr map2 #' @importFrom stats aggregate #' @@ -153,7 +154,9 @@ write_masked_functions <- function(){ write_used_functions <- function(){ used_functions_list <- get_log_element("used_packages_functions") - combined <- aggregate(function_name~library, used_functions_list, paste) + combined <- used_functions_list %>% + group_by(library) %>% + summarize(function_name = paste0(.data[["function_name"]], collapse = ", ")) map2(combined$library, combined$function_name, ~paste(paste0("{", .x, "}"), paste0(.y, collapse = ", "))) %>% unname() %>% @@ -183,7 +186,9 @@ write_unapproved_functions <- function(){ return("No unapproved packages or functions used") } - combined <- aggregate(function_name~library, unapproved_functions_list, paste) + combined <- unapproved_functions_list %>% + group_by(library) %>% + summarize(function_name = paste0(.data[["function_name"]], collapse = ", ")) map2(combined$library, combined$function_name, ~paste(paste0("{", .x, "}"), paste0(.y, collapse = ", "))) %>% unname() %>%