Skip to content

Commit

Permalink
fixed: order of names was wrong when called pivot_annotations on mu…
Browse files Browse the repository at this point in the history
…ltiple resources
  • Loading branch information
deeenes committed Aug 7, 2024
1 parent c16dced commit f47bd6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ importFrom(dplyr,filter)
importFrom(dplyr,first)
importFrom(dplyr,full_join)
importFrom(dplyr,group_by)
importFrom(dplyr,group_keys)
importFrom(dplyr,group_split)
importFrom(dplyr,if_any)
importFrom(dplyr,inner_join)
Expand Down
15 changes: 9 additions & 6 deletions R/annotations.R
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ annotation_categories <- function(){
#' @export
#' @importFrom magrittr %>% %<>% is_greater_than
#' @importFrom tidyr pivot_wider
#' @importFrom dplyr select pull group_split
#' @importFrom dplyr select pull group_split group_by group_keys
#' @importFrom purrr map
#' @importFrom rlang set_names
#' @importFrom readr type_convert cols
Expand All @@ -307,16 +307,19 @@ pivot_annotations <- function(annotations){
pull(source) %>%
unique %>%
length %>%
is_greater_than(1)
is_greater_than(1L)

if(more_than_one_resources){
if(more_than_one_resources) {

annotations %>%
group_split(source) %>%
set_names(annotations %>% pull(source) %>% unique %>% sort) %>%
group_by(source) %>%
{set_names(
group_split(.),
group_keys(.)$source
)} %>%
map(pivot_annotations)

}else{
} else {

id_cols <- c(
'record_id',
Expand Down

0 comments on commit f47bd6c

Please sign in to comment.