`split_save` breaks a dataset by the groups provided and then exports those individual frames as separate csv files. This process can be useful when working with data across multiple partners and then creating datasets to be sent to each of them with their own data.

split_save(df, group_var, folderpath, filename_stub, include_date = FALSE)

Arguments

df

dataframe to split

group_var

grouping variable to split the dataset by, eg operatingunit, funding_agency

folderpath

directory where you want to store the files

filename_stub

generic stub for naming all the files

include_date

include date after filenamestub? default = FALSE, eg "20180913"

Examples

if (FALSE) {
#create country specific files for TX_NEW
 df_mer %>%
  filter(indicator == "TX_NEW",
         standardizeddisaggregate == "Total Numerator") %>%
  split_save(operatingunit, "~/CountryFiles", "FY18Q3_TX")
}