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 199102
Number of columns 32
_______________________
Column type frequency:
character 1
numeric 31
________________________
Group variables None

Variable type: character

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

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
GAS 0 1 12791.82 5264.01 1556.0 8704.0 12930.0 16876.75 27472.0 ▃▆▇▅▁
COAL 0 1 8160.30 6573.91 0.0 1745.0 7285.0 13473.00 26044.0 ▇▅▅▂▁
NUCLEAR 0 1 7121.63 1025.01 3705.0 6430.0 7267.0 7903.00 9342.0 ▁▂▆▇▃
WIND 0 1 3200.58 3170.14 0.0 802.0 2154.0 4689.00 17129.0 ▇▃▁▁▁
HYDRO 0 1 397.71 246.55 0.0 193.0 368.0 567.00 1403.0 ▇▇▅▁▁
IMPORTS 0 1 1975.82 1098.15 0.0 1162.0 2010.0 2938.00 4884.0 ▅▅▇▆▁
BIOMASS 0 1 425.03 845.76 0.0 0.0 0.0 0.00 3204.0 ▇▁▁▁▁
OTHER 0 1 533.64 684.44 0.0 0.0 121.0 843.00 2456.0 ▇▂▂▁▁
SOLAR 0 1 625.91 1429.94 0.0 0.0 0.0 342.00 9680.0 ▇▁▁▁▁
STORAGE 0 1 311.84 349.13 0.0 0.0 294.0 454.00 2660.0 ▇▂▁▁▁
GENERATION 0 1 35544.26 7419.22 18708.0 29811.0 35486.0 40674.00 59500.0 ▃▇▇▃▁
CARBON_INTENSITY 0 1 390.74 138.72 57.0 267.0 406.0 509.00 695.0 ▂▆▆▇▂
LOW_CARBON 0 1 11770.86 4070.68 4626.0 8790.0 10706.0 14011.00 30746.0 ▇▇▃▁▁
ZERO_CARBON 0 1 11345.83 3622.82 4626.0 8694.0 10451.0 13434.00 28473.0 ▇▇▃▁▁
RENEWABLE 0 1 4224.20 3716.39 0.0 1275.0 3103.0 6221.75 23118.0 ▇▃▁▁▁
FOSSIL 0 1 20952.11 8761.39 2187.0 14292.0 20244.0 27168.00 49096.0 ▃▇▆▃▁
GAS_perc 0 1 35.57 12.22 5.0 26.5 36.5 45.00 66.8 ▂▆▇▇▁
COAL_perc 0 1 21.60 15.84 0.0 5.1 21.3 35.70 60.6 ▇▅▅▅▁
NUCLEAR_perc 0 1 20.89 5.25 9.2 17.0 20.1 24.00 43.1 ▃▇▃▁▁
WIND_perc 0 1 9.47 9.67 0.0 2.3 6.2 13.70 58.3 ▇▂▁▁▁
HYDRO_perc 0 1 1.10 0.64 0.0 0.6 1.0 1.50 4.2 ▇▇▃▁▁
IMPORTS_perc 0 1 5.97 3.62 0.0 3.2 6.1 8.60 18.9 ▆▇▆▂▁
BIOMASS_perc 0 1 1.30 2.61 0.0 0.0 0.0 0.00 15.9 ▇▁▁▁▁
OTHER_perc 0 1 1.59 2.11 0.0 0.0 0.4 2.60 10.5 ▇▂▁▁▁
SOLAR_perc 0 1 1.73 4.04 0.0 0.0 0.0 0.90 31.7 ▇▁▁▁▁
STORAGE_perc 0 1 0.78 0.84 0.0 0.0 0.7 1.20 6.1 ▇▂▁▁▁
GENERATION_perc 0 1 100.00 0.00 100.0 100.0 100.0 100.00 100.0 ▁▁▇▁▁
LOW_CARBON_perc 0 1 34.48 13.51 10.7 24.1 31.7 42.20 87.9 ▆▇▃▁▁
ZERO_CARBON_perc 0 1 33.19 12.14 10.7 24.0 31.0 40.10 85.1 ▆▇▃▁▁
RENEWABLE_perc 0 1 12.30 11.00 0.0 3.6 8.9 18.00 66.2 ▇▃▁▁▁
FOSSIL_perc 0 1 57.17 16.03 7.7 46.2 58.9 70.20 88.0 ▁▃▆▇▅

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 20.42 seconds ( 0.34 minutes) using knitr in RStudio with R version 3.6.0 (2019-04-26) running on x86_64-redhat-linux-gnu.

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 (J. Allaire et al. 2020,Xie, Allaire, and Grolemund (2018))

3.2 Session info

## R version 3.6.0 (2019-04-26)
## Platform: x86_64-redhat-linux-gnu (64-bit)
## Running under: Red Hat Enterprise Linux
## 
## Matrix products: default
## BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
## 
## locale:
##  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8       
##  [4] LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
##  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
## [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] skimr_2.1.1       ggplot2_3.3.1     lubridate_1.7.9   here_0.1          drake_7.12.2      data.table_1.12.0
## [7] woRkflow_0.1.0   
## 
## loaded via a namespace (and not attached):
##  [1] storr_1.2.1       progress_1.2.2    tidyselect_1.1.0  xfun_0.14         repr_1.1.0       
##  [6] purrr_0.3.4       colorspace_1.4-0  vctrs_0.3.1       generics_0.0.2    viridisLite_0.3.0
## [11] htmltools_0.3.6   yaml_2.2.0        base64enc_0.1-3   utf8_1.1.4        rlang_0.4.6      
## [16] pillar_1.4.4      txtq_0.2.0        glue_1.4.1        withr_2.1.2       lifecycle_0.2.0  
## [21] stringr_1.4.0     munsell_0.5.0     gtable_0.2.0      evaluate_0.14     labeling_0.3     
## [26] knitr_1.28        parallel_3.6.0    fansi_0.4.0       highr_0.7         Rcpp_1.0.1       
## [31] backports_1.1.3   scales_1.0.0      filelock_1.0.2    jsonlite_1.6      hms_0.5.3        
## [36] digest_0.6.25     stringi_1.2.4     bookdown_0.19     dplyr_1.0.0       grid_3.6.0       
## [41] rprojroot_1.3-2   cli_2.0.2         tools_3.6.0       magrittr_1.5      base64url_1.4    
## [46] tibble_3.0.1      crayon_1.3.4      pkgconfig_2.0.2   ellipsis_0.3.1    prettyunits_1.0.2
## [51] assertthat_0.2.0  rmarkdown_2.2     rstudioapi_0.11   R6_2.3.0          igraph_1.2.2     
## [56] compiler_3.6.0

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.