KnitR

KnitR is package for the RStudio, which allows to produce word processing documents, PDF, presentations,... with real-time embedding of data. E.g. current stock exchange rates can fetched, analyse within R and dependent on the analysis phrases and results can be inject e.g. in the text. The package KnitR is often used within RStudio as a graphical user interface for calling commands and scripts for the underlying statistic software R (see Knitr for details).

From the command line up to date reports can be generated automatically by processing a R-Markdown document and at processing time the current data sources (e.g. monitoring data) is evaluated in the statistical or numerical analysis.

If learners are able to see the R-Code in the learning document they can perform activities in the software for statistics on their own. Furthermore for research publications in the Wikiversity readers can
 * reproduce the results,
 * learn from the methodology,
 * apply the R-code on their own data,
 * check if the algorithm are appropriate for experimental design

Learning Modules

 * Understand the basic workflow of KnitR
 * Installation of KnitR
 * Standard Pitfalls and the solutions
 * Compilation of Output
 * Use Octave in KnitR
 * /Hello World Example/
 * /Sample Data/
 * /Fetching Data from an API/
 * /Use KnitR/
 * /External Code Chunk/
 * Future: KnitR-Integration/-Inteface for Wikiversity or a WikiJournal

Technical Tasks for Learners

 * (/Installation/) Install RStudio and the package KnitR and create and process your first KnitR-document.
 * (Octave in KnitR) Analyse the possibility to integrate the calculations with Octave in a KnitR markdown document.

Learning Task
In the previous section the workflow of a integrated approach of KnitR was elaborated. Due to the fact that this concept is not implemented yet as extension in MediaWiki yet, the workflow cannot performed with code chunk for mathematical calculations in the MediaWiki of Wikiversity directly. But it possible to learn about the workflow in general:
 * Install R-Studio and R on your computer.
 * Install the KnitR-Package in R-Studio.
 * Download /Sample Data/ e.g. R Sample Data by Guru99
 * Learn about KnitR with Screencasts (Youtube) and perform a basic KnitR tutorial so that you get the first dynamic report.
 * Video - Learn Knitr in 5min (Youtube) by Ram Narasimhan - retrieved 2016/10/11
 * Video - Professional Report Writing with Sweave, LaTeX, and R (Youtube) by Nicolas Yager - retrieved 2016/10/11
 * knitr: Automatically embedding R output in documents (Youtube) by Joshua Wiley 2013/10/14
 * Advanced Learners/Spatial Analysis: Apply a scenario in the Risk Management Module for creating Risk Maps. What are additional requirements for the spatial analysis?
 * learn about the design of Geographic Information Systems (GIS) (Classification Resource by Dave Braunschweig),
 * install Open Source Quantum GIS and explore the QGIS manual and try to match the general element of GIS with features offered in QGIS manual (Furthermore explore QGIS ScreenCasts on Youtube according to level of expertise in GIS).
 * extract data from GIS database process spatial data with R-script,
 * integrate generated maps and calculated R results in the KnitR document (Spatial Analysis with R Youtube published by Domino Data Lab 2016/02).
 * (Jupyter) Analyse the Open Source framework Jupyter and analyse the difference and similarities between KnitR and Jupyter. When will you use KnitR and when would you use Jupyter.
 * Analyse the COVID-19 outbreak and the requirements of dynamic updates in 2020. What are the requirements and constraints to create a dynamic report mechanism based on KnitR and R for the COVID-19 epidemics.
 * Explore the concept of Scientific Hackathon and explain why KnitR can be used as a development environment for decision support products!
 * (KnitR Templates) Create a KnitR template that loads input data from a dataset  calls a   function and creates an   for processed data. Include some of source data and aggregated source data in the R-Markdown.

Some external knitR tutorials

 * Rstudio, an IDE to create knitR documents, containts also simple examples
 * Karl Broman's minimal tutorial discusses the very basics of knitR, a very good point to get you started
 * The knitR homepage does not only contain the source, but also some links and examples
 * An introductional video on YouTube, which illustrates the generation of a knitR document using RStudio
 * A nice short video to get you started in only five minutes

Wiki to Markdown Conversion with PanDoc
The OpenSource tool PanDoc is called the "swiss army knife" of document conversion. Assume we have a KnitR document of a scientific paper that contains the KnitR code chunks for processing the data, that was analysed.
 * converted the Markdown document of the paper with PanDoc-Online Converter in a MediaWiki document.
 * Create a sample document with the knitr-package in RStudio and save the R-Markdown file with the extension Rmd to your harddrive.
 * Copy the content of your R-Markdown document to PanDoc-Online Converter,
 * select Markdown (pandoc) as input format,
 * select MediaWiki as output format,
 * press Convert-button and analyze the generated MediaWiki syntax of the text.
 * The R-Code chunks for the analysis of the data (e.g. loaded from CSV file of spreadsheet document) is converted into a &lt;code&gt;-environment.
 * This converted KnitR document is stored together with the scientific papers in the WikiJournal (e.g. WikiJournal of Medicine). If sampling of data was performed in the same way the application of the KnitR-document with the new data will be performed in the same algorithmic way. This KnitR-approach contributes to a workflow for Reproducible Science.