Sponsored Links
-->

Friday, April 13, 2018

LaTeX Tutorial 10a: LaTeX + R, knitr - YouTube
src: i.ytimg.com

knitr is an engine for dynamic report generation with R. It is a package in the statistical programming language R that enables integration of R code into LaTeX, LyX, HTML, Markdown, AsciiDoc, and reStructuredText documents. The purpose of knitr is to allow reproducible research in R through the means of Literate Programming. It is licensed under the GNU General Public License.

knitr was inspired by Sweave and written with a different design for better modularization, so it is easier to maintain and extend. Sweave can be regarded as a subset of knitr in the sense that all features of Sweave are also available in knitr. Some of knitr extensions include the R Markdown format (used in reports published on RPubs), caching, TikZ graphics and support to other languages such as Python, Perl, C++, Shell scripts and CoffeeScript, and so on.

knitr is officially supported in the RStudio IDE for R, LyX, Emacs/ESS and the Architect IDE for data science.


Video Knitr



Workflow of KnitR

KnitR consists of standard e.g. MarkDown document with R-code chunks integrated in the document. The code chunks can be regarded as R-scripts that

  • load data,
  • performs data processing and
  • creates output data (e.g. descriptive analysis) or output graphics (e.g. boxplot diagram).

The implementation of logical conditions in R can provide text elements for the dynamic report depended on the statistical analysis. The following text is as stan

     The Wilcoxon Sign test was applied as statistical comparison of the average of two dependent samples above.      In this case then, the calculated P-value was 0.56 and hence greater than the significance (0.05 by default).     This implies that "H0: there is no difference between the         results in data1 and data2" must be accepted.   

Depending on the R results (here 0.56) the text fragments are determined by logical conditions in the R-script. If the P-value were 0.04, which is lower than the significance (0.05 by default), an other appropriate text fragment would get inserted in the dynamic report. By this workflow the replacement of the input data of the statistical or numerical analysis in R creates a reproducible report which the same methodology.


Maps Knitr



See also

  • The R Programming wikibook
  • Reproducible Research

Interactive HTML presentation with R, googleVis, knitr, pandoc and ...
src: s-media-cache-ak0.pinimg.com


References


knitr bibLaTeX tutorial - YouTube
src: i.ytimg.com


External links

  • Official website
  • Repository on GitHub
  • Example code on GitHub
  • knitr package on CRAN


Source of article : Wikipedia