Skip to content

Commit

Permalink
modified row merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-masel committed Mar 27, 2024
1 parent 700fe00 commit d2a4e5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions R/writer.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
#'
Expand All @@ -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() %>%
Expand Down Expand Up @@ -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() %>%
Expand Down

0 comments on commit d2a4e5c

Please sign in to comment.