- Your folder structure should be set up to mimic the layout in README_R_SETUP, like this example:
## [1] "C:/Users/HHAY/OneDrive - Government of BC/Optimization/Scripting/RStudio_Heather/.Rproj.user"
## [2] "C:/Users/HHAY/OneDrive - Government of BC/Optimization/Scripting/RStudio_Heather/figure"
## [3] "C:/Users/HHAY/OneDrive - Government of BC/Optimization/Scripting/RStudio_Heather/output"
## [4] "C:/Users/HHAY/OneDrive - Government of BC/Optimization/Scripting/RStudio_Heather/scripts"
## [5] "C:/Users/HHAY/OneDrive - Government of BC/Optimization/Scripting/RStudio_Heather/source"
The raw data from OCIO should be cleaned using clean_sfp_enhanced.py or format_raw_enhanced_report.rmd and saved to the source folder
The following 7 files should be in your scripts folder:
enhanced_sfp_report_overview.rmd
enhanced_sfp_report_folder.rmd
enhanced_sfp_report_share.rmd
render_enhanced_sfp_report_overview.R
render_sfp_enhanced_report_folder.R
render_sfp_enhanced_report_share.R
GFX_OptimizationLogo-Icon_v2.png
- open the file render_enhanced_sfp_report_overview.R
- change the bracketed text in the final line of the script to your desired parameters, like in this example:
# render_report("2022-01-01_EMLI_Enhanced_Data.csv", "EMLI", "Q4", "FY21-22", "2021-12-22")
there are 5 mandatory fields to enter in order:
the name of the csv file (you must include .csv in the file name)
the acronym of the Minstry
the fiscal quarter (please format as Q# for consistency)
the fiscal year (please format as FY##-## for consistency)
the date on the raw data file from the OCIO, so clients have an idea of when the storage snapshot was taken
select all the text (ctrl-a) and then run the script by either pressing ctrl-Enter OR pressing the “Run” button in R Studio at the top right.
The end result is 2 files in your output folder, named dynamically based on the parameters you input earlier.
- SFP_Enhanced_Report_ministry_quarter_fiscalyear.xlsx
- SFP_Enhanced_Report_ministry_quarter_fiscalyear.html
- open the file render_enhanced_sfp_report_folder.R
- change the bracketed text in the final line of the script to your desired parameters, like in this example:
# render_report("2021-04-01_ENV_SFP_Enhanced_Data.csv", "^\\\\\\\\SLEDGE\\\\S40203\\\\IRMT", "IRMT", "Q1", "FY21-22", "2021-04-27")
there are 6 mandatory fields to enter in order:
the name of the csv file (you must include .csv in the file name)
the folder path (please keep the caret and leading backslashes - there are 8 before the server and 4 before the share and each folder). If you have a folder name in your path that has parentheses in it, enclose the parentheses in square brackets so that they’re “escaped” from the regex expression. This also applies to the step below.
i.e. ADMINISTRATION (100-499) needs square brackets around (100-499)the final folder name exactly as it is in the folder path. It is used as a “boundary” in the main script for when folder names are similar, but you only want to pull information from one of them. i.e. a simple filter on “ROB” might get you “ROB”, “ROB FOI”, and “ROBERTSON CREEK”, but having the boundary applied ensures you only get “ROB”.
the fiscal quarter (please format as Q# for consistency)
the fiscal year (please format as FY##-## for consistency)
the date on the raw data file from the OCIO, so clients have an idea of when the storage snapshot was taken (please format as YYYY-MM-DD for consistency)
select all the text (ctrl-a) and then run the script by either pressing ctrl-Enter OR pressing the “Run” button in R Studio at the top right.
The end result is 2 files in your output folder, named dynamically based on the parameters you input earlier.
- SFP_Enhanced_Report_foldername_quarter_fiscalyear.xlsx
- SFP_Enhanced_Report_foldername_quarter_fiscalyear.html
- open the file enhanced_sfp_report_share.rmd or enhanced_sfp_report_folder.rmd or enhanced_sfp_report_overview.rmd
- press the arrow beside “Knit” and select “Knit with Parameters”
- populate the fields in the resultant prompt window with your parameters, following the examples provided
- press “Knit”
The end result is an excel file in your output folder (named dynamically based on the parameters you input earlier), and a html file in your scripts folder - it will have the same name as your script so be sure to rename it so it doesn’t get overwritten the next time you knit.
- SFP_Enhanced_Report_ministry_quarter_fiscalyear.xlsx or SFP_Enhanced_Report_foldername_quarter_fiscalyear.xlsx or SFP_Enhanced_Report_sharename_quarter_fiscalyear.xlsx
- enhanced_sfp_report_overview.html or enhanced_sfp_report_share.html or enhanced_sfp_report_folder.html