====== Reproducible Research ======
In this page we show how to create a minimal report using R + Latex + Markdown Resources. Lets create a minimal report from few R commands :
# loaddata
data(iris)
# summarydata
summary(iris)
# boxplot
boxplot(iris[,1]~iris[,5])
# table
table(iris[,5])
We can embbed those commands into a simple LaTeX file according to the example below :
\documentclass{article}
\title{Introduction to Reproducible Research in R}
\author{Bioinformatics Meeting}
\begin{document}
\maketitle
\section{Introduction}
This document contains a minimal example of reproducible research using R.
\section{Loading Data}
<>=
# loading data set
data(iris)
@
\section{Summary of Data}
<>=
# summary of the data set
summary(iris)
@
\section{A Box Plot}
<>=
# building a box plot
boxplot(iris$Sepal.Length~iris$Species)
@
\section{A Table}
<>=
# loading xtable package
require(xtable)
# creating a table
tab<-table(iris$Species)
# buiding a table with all data
print(xtable(tab))
@
\section{Aditional Tips}
<<>>=
# let it commented
# purl("report.rnw")
# system("pandoc -s report.tex -o report.docx")
@
\end{document}
Save the commands above into a file called report.rnw and compile it into a LaTeX document according to the commands below.
library(knitr)
knit("report.rnw")
This will generate a .tex file that can be processed by a LaTex editor!
For linux and mac users, you can run :
> tex2pdf report.tex
to convert the result into a pdf