adorn_achievement: Adorn Achievement - Percent and Color

View source: R/calc_achievement.R

adorn_achievementR Documentation

Adorn Achievement - Percent and Color

Description

'adorn_achievement' calculate target achievement (cumulative and/or quarterly) for a standard MSD or one reshaped using 'reshape_msd'()' as well as to apply achievement group labels and colors. It will run 'calc_achievement' if an achievement column does not exist in the dataset.

Usage

adorn_achievement(df, qtr = NULL, classic = FALSE)

Arguments

df

data frame as standrd MSD or one from reshape_msd()

qtr

if using standard MSD, need to provide the most recent quarter, ideally using identifypd(df_msd, pd_type = "quarter")

classic

use the original OHA achievement color palette (pre July 2024), default = FALSE

Value

data frame with achievement values, labels, and colors

See Also

Other achievement: calc_achievement()

Examples

## Not run: 
df_msd <- read_msd(path)
df_msd_agg <- df_msd %>%
 filter(operatingunit == "Jupiter"
        indicator %in% c("TX_NEW", "TX_CURR"),
        funding_agency != "Dedup",
        standardizeddisaggregate == "Total Numerator") %>%
 group_by(operatingunit, funding_agency, fiscal_year, indicator) %>%
 summarise(across(where(is.double), sum, na.rm = TRUE)) %>%
 ungroup()

adorn_achievement(df_msd_agg)

df_msd_agg %>%
 reshape_msd("quarters") %>%
 adorn_achievement()

df_msd_agg %>%
 reshape_msd("quarters", qtrs_keep_cumulative = TRUE) %>%
 adorn_achievement() 
## End(Not run)

USAID-OHA-SI/gophr documentation built on Nov. 14, 2024, 8:30 p.m.