From 25b8a6abfbe1a866990fa391137e90765e0da3a9 Mon Sep 17 00:00:00 2001 From: CJ Yetman Date: Tue, 11 Jun 2024 12:29:49 +0200 Subject: [PATCH] show highest weight companies, not lowest in company bars - closes #82 This needs serious review and testing. Just getting a hypothetical fix down for review. --- R/prep_key_bars_company.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/prep_key_bars_company.R b/R/prep_key_bars_company.R index a3c4188..e1c263a 100644 --- a/R/prep_key_bars_company.R +++ b/R/prep_key_bars_company.R @@ -28,7 +28,7 @@ prep_key_bars_company <- mutate(asset_class = "Listed Equity") %>% mutate_at("id", as.character) %>% # convert the col type to character to prevent errors in case empty df is binded by rows group_by(.data$ald_sector, .data$technology) %>% # select at most 15 companies with the highest weigths per sector+technology - arrange(.data$port_weight, .by_group = TRUE) %>% + arrange(dplyr::desc(.data$port_weight), .by_group = TRUE) %>% slice(1:15) %>% filter(!is.null(.data$port_weight)) %>% filter(!is.null(.data$plan_tech_share)) @@ -62,7 +62,7 @@ prep_key_bars_company <- slice(1:15) %>% group_by(.data$ald_sector) %>% arrange(factor(.data$technology, levels = .env$all_tech_levels)) %>% - arrange(.data$port_weight, .by_group = TRUE) %>% + arrange(dplyr::desc(.data$port_weight), .by_group = TRUE) %>% filter(!is.null(.data$port_weight)) %>% filter(!is.null(.data$plan_tech_share))