Knitting Statistics Notes: Creating Teaching Materials with Data Analysis Code and Results Embedded

Nicola F. Reeve

Abstract


R is a widely used, free, open source software package for data analysis and graphics. Along with core functionality, there are many additional packages to enable specialist usage. One of these packages ‘knitr' allows the integration of R and LaTeX code. This means that code, output and narrative are all included in one source document. Output is generated automatically from the code. If any changes are made to the data, all output is updated automatically. From a teaching perspective, this is particularly useful if you want to create notes with various graphs, statistics etc and you also want to provide the code that shows the student how to do this analysis in R. It is possible to hide either the code or the output. For example, if you are making introduction to statistics worksheets for non-statistics students, you might not want to include R code. If you are including exercises for students, you might not want to include the output and instead have them answer some questions. You can also set these options globally then by changing one option, create two versions of the document - one with solutions, one without, just from one source document.


Keywords


R, knitr, teaching notes, embedded code, individualised assessments

Full Text:

PDF

References


Knuth, D.E., 1984. Literate programming. The Computer Journal, 27(2), pp.97-111.

RStudio, 2016. RStudio. www.rstudio.com.

R Core Team, 2015. R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. Available at: https://www.R-project.org/ .

Xie, Y., 2015. Dynamic Documents with R and knitr. Boca Raton: CRC Press.

Xie, Y., 2016. knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.15.1.




DOI: http://dx.doi.org/10.21100/msor.v15i3.354

Refbacks

  • There are currently no refbacks.