1 A basic .Rmd template to illustrate our workflow

1.1 Data

The following uses skimr::skim() to describe the data. Remember we created the skim output object in the R script. We just report it here.

Table 1.1: Data summary
Name esoData
Number of rows 201022
Number of columns 34
_______________________
Column type frequency:
character 1
factor 1
numeric 31
POSIXct 1
________________________
Group variables None

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
DATETIME 0 1 19 19 0 201022 0

Variable type: factor

skim_variable n_missing complete_rate ordered n_unique top_counts
weekDay 0 1 TRUE 7 Thu: 28752, Fri: 28750, Sun: 28704, Mon: 28704

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
GAS 0 1 12753.47 5269.71 1556.0 8635.0 12880.0 16852.0 27472.0 ▃▆▇▅▁
COAL 0 1 8082.35 6590.29 0.0 1613.0 7172.0 13421.0 26044.0 ▇▃▅▂▁
NUCLEAR 0 1 7101.74 1041.41 3705.0 6405.0 7256.0 7896.0 9342.0 ▁▂▆▇▃
WIND 0 1 3220.80 3180.72 0.0 809.0 2172.0 4728.0 17129.0 ▇▃▁▁▁
HYDRO 0 1 396.56 246.11 0.0 192.0 366.0 565.0 1403.0 ▇▇▅▁▁
IMPORTS 0 1 1981.60 1099.72 0.0 1168.0 2018.0 2944.0 4884.0 ▅▅▇▆▁
BIOMASS 0 1 442.48 863.09 0.0 0.0 0.0 0.0 3204.0 ▇▁▁▁▁
OTHER 0 1 529.97 682.21 0.0 0.0 121.0 834.0 2456.0 ▇▂▂▁▁
SOLAR 0 1 642.51 1458.01 0.0 0.0 0.0 367.0 9680.0 ▇▁▁▁▁
STORAGE 0 1 310.04 348.86 0.0 0.0 294.0 452.0 2660.0 ▇▂▁▁▁
GENERATION 0 1 35461.52 7444.52 18287.0 29708.0 35384.0 40624.0 59512.0 ▃▇▇▃▁
CARBON_INTENSITY 0 1 388.69 139.73 54.0 264.0 403.0 508.0 695.0 ▂▆▆▇▂
LOW_CARBON 0 1 11804.09 4086.59 4626.0 8802.0 10737.0 14064.0 30746.0 ▇▇▃▁▁
ZERO_CARBON 0 1 11361.61 3636.51 4626.0 8698.0 10466.0 13459.0 28473.0 ▇▇▃▁▁
RENEWABLE 0 1 4259.87 3741.31 0.0 1284.0 3136.0 6271.0 23118.0 ▇▃▁▁▁
FOSSIL 0 1 20835.82 8809.41 2421.0 14126.0 20129.0 27086.0 49096.0 ▃▇▆▃▁
GAS_perc 0 1 35.54 12.23 5.0 26.5 36.4 45.0 70.1 ▂▆▇▆▁
COAL_perc 0 1 21.39 15.91 0.0 4.8 21.0 35.6 60.6 ▇▅▅▅▁
NUCLEAR_perc 0 1 20.88 5.24 9.2 17.0 20.1 24.0 43.1 ▃▇▃▁▁
WIND_perc 0 1 9.57 9.77 0.0 2.3 6.3 13.8 58.3 ▇▂▁▁▁
HYDRO_perc 0 1 1.10 0.64 0.0 0.6 1.0 1.5 4.2 ▇▇▃▁▁
IMPORTS_perc 0 1 6.01 3.64 0.0 3.2 6.2 8.6 18.9 ▆▇▆▂▁
BIOMASS_perc 0 1 1.37 2.71 0.0 0.0 0.0 0.0 16.1 ▇▁▁▁▁
OTHER_perc 0 1 1.58 2.11 0.0 0.0 0.4 2.6 10.5 ▇▂▁▁▁
SOLAR_perc 0 1 1.79 4.16 0.0 0.0 0.0 1.0 32.8 ▇▁▁▁▁
STORAGE_perc 0 1 0.78 0.84 0.0 0.0 0.7 1.2 7.9 ▇▁▁▁▁
GENERATION_perc 0 1 100.00 0.00 100.0 100.0 100.0 100.0 100.0 ▁▁▇▁▁
LOW_CARBON_perc 0 1 34.70 13.69 10.7 24.2 31.8 42.5 87.9 ▆▇▃▁▁
ZERO_CARBON_perc 0 1 33.33 12.27 10.7 24.0 31.1 40.3 85.1 ▆▇▃▁▁
RENEWABLE_perc 0 1 12.46 11.16 0.0 3.6 9.0 18.2 66.2 ▇▃▁▁▁
FOSSIL_perc 0 1 56.93 16.19 9.0 45.9 58.7 70.1 88.0 ▁▃▆▇▅

Variable type: POSIXct

skim_variable n_missing complete_rate min max median n_unique
rDateTime 0 1 2009-01-01 2020-06-19 22:30:00 2014-09-25 23:15:00 201022

There’s quite a lot of data…

1.2 Plot

1.1 plots every data point in the data (!). Remember we created the plot output object in the R script. We just print it here.

Half-hourly generation (GW)

Figure 1.1: Half-hourly generation (GW)

2 Runtime

Report generated in 142.29 seconds ( 2.37 minutes) using knitr in RStudio with R version 3.6.3 (2020-02-29) running on x86_64-apple-darwin15.6.0.

3 R environment

3.1 R packages used

  • base R (R Core Team 2016)
  • bookdown (Xie 2018)
  • data.table (Dowle et al. 2015)
  • drake (Landau 2018)
  • ggplot2 (Wickham 2009)
  • here (Müller 2017)
  • knitr (Xie 2016)
  • lubridate (Grolemund and Wickham 2011)
  • rmarkdown (Allaire et al. 2020,@rmarkdownBook)

3.2 Session info

## R version 3.6.3 (2020-02-29)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Catalina 10.15.5
## 
## Matrix products: default
## BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] skimr_2.1         ggplot2_3.3.0     lubridate_1.7.4   here_0.1         
## [5] drake_7.11.0      data.table_1.12.8 woRkflow_0.1.0   
## 
## loaded via a namespace (and not attached):
##  [1] storr_1.2.1       progress_1.2.2    tidyselect_1.0.0  xfun_0.12        
##  [5] repr_1.1.0        purrr_0.3.3       colorspace_1.4-1  vctrs_0.2.4      
##  [9] viridisLite_0.3.0 htmltools_0.4.0   yaml_2.2.1        base64enc_0.1-3  
## [13] utf8_1.1.4        rlang_0.4.5       pillar_1.4.3      txtq_0.2.0       
## [17] glue_1.3.2        withr_2.1.2       lifecycle_0.2.0   stringr_1.4.0    
## [21] munsell_0.5.0     gtable_0.3.0      evaluate_0.14     labeling_0.3     
## [25] knitr_1.28        parallel_3.6.3    fansi_0.4.1       highr_0.8        
## [29] Rcpp_1.0.4        scales_1.1.0      backports_1.1.5   filelock_1.0.2   
## [33] jsonlite_1.6.1    farver_2.0.3      hms_0.5.3         packrat_0.5.0    
## [37] digest_0.6.25     stringi_1.4.6     bookdown_0.18     dplyr_0.8.5      
## [41] grid_3.6.3        rprojroot_1.3-2   cli_2.0.2         tools_3.6.3      
## [45] magrittr_1.5      base64url_1.4     tibble_2.1.3      crayon_1.3.4     
## [49] tidyr_1.0.2       pkgconfig_2.0.3   prettyunits_1.1.1 rmarkdown_2.1    
## [53] assertthat_0.2.1  rstudioapi_0.11   R6_2.4.1          igraph_1.2.5     
## [57] compiler_3.6.3

References

Allaire, JJ, Yihui Xie, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, Hadley Wickham, Joe Cheng, Winston Chang, and Richard Iannone. 2020. Rmarkdown: Dynamic Documents for R. https://github.com/rstudio/rmarkdown.

Dowle, M, A Srinivasan, T Short, S Lianoglou with contributions from R Saporta, and E Antonyan. 2015. Data.table: Extension of Data.frame. https://CRAN.R-project.org/package=data.table.

Grolemund, Garrett, and Hadley Wickham. 2011. “Dates and Times Made Easy with lubridate.” Journal of Statistical Software 40 (3): 1–25. http://www.jstatsoft.org/v40/i03/.

Landau, William Michael. 2018. “The Drake R Package: A Pipeline Toolkit for Reproducibility and High-Performance Computing.” Journal of Open Source Software 3 (21). https://doi.org/10.21105/joss.00550.

Müller, Kirill. 2017. Here: A Simpler Way to Find Your Files. https://CRAN.R-project.org/package=here.

R Core Team. 2016. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.

Wickham, Hadley. 2009. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. http://ggplot2.org.

Xie, Yihui. 2016. Knitr: A General-Purpose Package for Dynamic Report Generation in R. https://CRAN.R-project.org/package=knitr.

———. 2018. Bookdown: Authoring Books and Technical Documents with R Markdown. https://github.com/rstudio/bookdown.

Xie, Yihui, J.J. Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown.