source_info.Rd
This function is used primarily to extract the data from the source file of a MER Structured Dataset, MER NAT_SUBNAT Structured Dataset, Financial Structure Dataset, or DATIM Genie export. It can also be used to extact information from the filename about the fiscal year, quarter, or period.
source_info(path, type, return = "source")
path to the folder containing MSDs or specific MSD file
not required unless providing a folder in `path`; default = "OU_IM_FY21"; other examples include: "PSNU_IM", "NAT_SUBNAT", "PSNU", "Financial", "HRH"
from the info, what should be returned; default = "source" other options are: "period", "fiscal_year", "fiscal_year_label","quarter"
vector of information related to what is being asked in `return`
Other metadata:
extract_metadata()
,
get_metadata()
if (FALSE) { # \dontrun{
source_info() #works if you have stored path to the MSD folder via glamr::set_paths()
source_info("../Data", type = "PSNUxIM")
source_info("../Data", type = "PSNUxIM", return = "period")
source_info("../Downloads/Genie_PSNU_IM_Jupiter_Daily_c9f5889f-86c9-44e7-ab63-fa86c587d251.zip")
source_info("../Data/MER_Structured_Datasets_NAT_SUBNAT_FY15-21_20210618_v2_1.rds") } # }
if (FALSE) { # \dontrun{
library(tidyverse)
library(glamr)
library(glue)
df <- si_path() %>%
return_latest("OU_IM") %>%
read_msd()
df_viz <- df %>%
filter(operatingunit == "Saturn",
indicator == "TX_NEW",
standardizeddisaggregate == "Total Numerator") %>%
count(fiscal_year, wt = targets, name = "targets")
df_viz %>%
ggplot(aes(fiscal_year, targets)) +
geom_col() +
labs(caption = glue("Source: {source_info()}")) } # }