Skip to content

Commit

Permalink
Remove NA values at read, filter for variables with 'percentile' suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
tonnrueter committed Mar 4, 2024
1 parent fa96b29 commit 624b95a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/plotPercentiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ plotPercentiles <- function(df, scenarios = NULL, variables = NULL) {
# follow the format "Any|Variable|5.0th Percentile". The regular expressions below divide the variable name into the
# prefix and the percentile specifier
data <- df %>%
as.quitte(na.rm = TRUE) %>%
mutate(
"percentile" = stringr::str_extract(.data$variable, "[^\\|]+?$"),
"variable" = gsub("\\|[^\\|]+$", "", .data$variable)
) %>%
filter(grepl(" Percentile$", .data$percentile)) %>%
pivot_wider(
names_from = "percentile",
values_from = "value"
Expand Down

0 comments on commit 624b95a

Please sign in to comment.