Using `gophr::reshape_msd()` often creates the a perfable long dataset when working with the MSD, but may restrict the user to certain default during the process. Creating a clean period (eg FY22Q1) requires a number of lines of code to get right, so this function provides stopgap when you are working with a long dataset that has a fiscal year and quarter column and desire a period variable.
convert_fy_qtr_to_pd(df, fy_ind = "fiscal_year", qtr_ind = "qtr")
united period column combining and cleaning fiscal year and quarter
Other period:
convert_date_to_qtr()
,
convert_datim_pd_to_qtr()
,
convert_qtr_to_date()
if (FALSE) {
df_summary <- df_msd %>%
filter(indicator == "TX_CURR",
standardizeddisaggregate == "Total Numerator",
operatingunit == "Jupiter") %>%
group_by(mech_code, fiscal_year) %>%
summarise(across(starts_with("qtr"), sum, na.rm = TRUE),
.groups = "drop")
df_summary <- df_summary %>%
pivot_longer(-c(mech_code, fiscal_year), names_to = "qtrs")
df_summary <- convert_fy_qtr_to_pd(df_summary)
}