convert_fy_qtr_to_pd | R Documentation |
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")
df |
MSD data frame reshaped long, eg 'pivot_longer' |
fy_ind |
indicator name in df for the fiscal year, default = "fiscal_year" |
qtr_ind |
indicator name in the df for quarters, default = "qtrs" |
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()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.