A repo supporting analysis of NZ GREEN Grid electricity demand data for EECA.
- New Zealand GREEN Grid Household Electricity Demand Study 2014-2018;
- New Zealand Grid Export data for 2015;
- New Zealand Census 2013 household counts;
Best viewed at https://cfsotago.github.io/GREENGridEECA/
This repo is structured as an R package. This means you (should) be able to install it using:
devtools::install_github("CfSOtago/GREENGridEECA")
If you try to do so and it fails, please check you have all the R packages that it depends on. This includes the GREENGridData package (to save wheel re-invention).
Note that to run the code you will need to register with the UK Data Service, agree to the re-use conditions and download the data.
- Run
setup()
at the start of a .R or .Rmd script as it sources./repoParams.R
which sets a range of parameters, including data file paths. - Generally use a makefile.R to run
setup()
, set other parameters and load or pre-process data. Then callrender()
to generate your output from a .Rmd file that uses the pre-loaded data. This means you only need to re-run the report not the whole data loading process each time you change the .Rmd. You will find various examples of this approach in the reports code. If you are feeling adventerous we recommend using drake to further streamline your analysis. GREENGridEEECA
package functions should be called using theGREENGridEEECA::function()
form so future users can identify when a function from this package is being used. Code for these functions is in /R.- Functions from other packages should be called in the same way for the same reason e.g.
lubridate::date()
. - Functions that are only defined in the .R or .Rmd file they are used in should just be called as
functionName()
. They should also be listed at the top of the file so they are easy to find!