From d2a4e5c968e89b064363973253ffc4d3d22165a5 Mon Sep 17 00:00:00 2001 From: Nicholas Masel Date: Wed, 27 Mar 2024 13:44:38 +0000 Subject: [PATCH 1/3] modified row merge --- NAMESPACE | 1 + R/writer.R | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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/R/writer.R b/R/writer.R index 986c04a..9e5991e 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(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(function_name, collapse = ", ")) map2(combined$library, combined$function_name, ~paste(paste0("{", .x, "}"), paste0(.y, collapse = ", "))) %>% unname() %>% From 84e2cb986f8b3f84c050b372fdf93c9539185ab0 Mon Sep 17 00:00:00 2001 From: Nicholas Masel Date: Wed, 27 Mar 2024 14:00:52 +0000 Subject: [PATCH 2/3] news and bump version --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/writer.R | 4 ++-- 3 files changed, 7 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/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 9e5991e..7d77d69 100644 --- a/R/writer.R +++ b/R/writer.R @@ -156,7 +156,7 @@ write_used_functions <- function(){ combined <- used_functions_list %>% group_by(library) %>% - summarize(function_name = paste0(function_name, collapse = ", ")) + summarize(function_name = paste0(.data[[function_name]], collapse = ", ")) map2(combined$library, combined$function_name, ~paste(paste0("{", .x, "}"), paste0(.y, collapse = ", "))) %>% unname() %>% @@ -188,7 +188,7 @@ write_unapproved_functions <- function(){ combined <- unapproved_functions_list %>% group_by(library) %>% - summarize(function_name = paste0(function_name, collapse = ", ")) + summarize(function_name = paste0(.data[[function_name]], collapse = ", ")) map2(combined$library, combined$function_name, ~paste(paste0("{", .x, "}"), paste0(.y, collapse = ", "))) %>% unname() %>% From 2720dccf30f48fa6fc7c54b06b0961eb0556016e Mon Sep 17 00:00:00 2001 From: Nicholas Masel Date: Wed, 27 Mar 2024 15:31:21 +0000 Subject: [PATCH 3/3] fix .data syntax --- R/writer.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/writer.R b/R/writer.R index 7d77d69..059b4ce 100644 --- a/R/writer.R +++ b/R/writer.R @@ -156,7 +156,7 @@ write_used_functions <- function(){ combined <- used_functions_list %>% group_by(library) %>% - summarize(function_name = paste0(.data[[function_name]], collapse = ", ")) + summarize(function_name = paste0(.data[["function_name"]], collapse = ", ")) map2(combined$library, combined$function_name, ~paste(paste0("{", .x, "}"), paste0(.y, collapse = ", "))) %>% unname() %>% @@ -188,7 +188,7 @@ write_unapproved_functions <- function(){ combined <- unapproved_functions_list %>% group_by(library) %>% - summarize(function_name = paste0(.data[[function_name]], collapse = ", ")) + summarize(function_name = paste0(.data[["function_name"]], collapse = ", ")) map2(combined$library, combined$function_name, ~paste(paste0("{", .x, "}"), paste0(.y, collapse = ", "))) %>% unname() %>%