Não foi possível enviar o arquivo. Será algum problema com as permissões?
Diferenças

Diferenças

Aqui você vê as diferenças entre duas revisões dessa página.

Link para esta página de comparações

Ambos lados da revisão anterior Revisão anterior
Próxima revisão
Revisão anterior
projetos:reproducibleresearch [2014/03/17 17:50]
joel [Reproducible Research]
projetos:reproducibleresearch [2014/03/17 18:04] (atual)
joel [Reproducible Research]
Linha 5: Linha 5:
  
 <​code> ​ <​code> ​
-## @knitr ​loaddata+# loaddata
 data(iris) data(iris)
  
-## @knitr ​summarydata+# summarydata
 summary(iris) summary(iris)
  
-## @knitr ​boxplot+# boxplot
 boxplot(iris[,​1]~iris[,​5]) boxplot(iris[,​1]~iris[,​5])
  
-## @knitr ​table+# table
 table(iris[,​5]) table(iris[,​5])
 +
 +</​code>​
 +
 +We can embbed those commands into a simple LaTeX file according to the example below :
 +
 +<​code> ​
 +\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}
 +<<​loaddata>>​=
 +# loading data set
 +data(iris)
 +@
 +
 +
 +\section{Summary of Data}
 +<<​summarydata>>​=
 +# summary of the data set
 +summary(iris)
 +@
 +
 +\section{A Box Plot}
 +<<​boxplot>>​=
 +# building a box plot
 +boxplot(iris$Sepal.Length~iris$Species)
 +@
 +
 +
 +\section{A Table}
 + 
 +<<​table,​results='​asis'>>​=
 +# 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}
  
 </​code> ​ </​code> ​
 +
 +Save the commands above  into a file called report.rnw and compile it into a LaTeX document according to the commands below.
 +
 +<​code>​
 +library(knitr)
 +knit("​report.rnw"​)
 +</​code>​
 +
 +This will generate a .tex file that can be processed by a LaTex editor! ​
 +
 +For linux and mac users, you can run :
 +
 +<​code>​
 +> tex2pdf report.tex
 +</​code>​
 +
 +to convert the result into a pdf
 +
 + 

QR Code
QR Code projetos:reproducibleresearch (generated for current page)