1. Automatic reports with knitr
How to organize recurring data analysis output
Ryan P. Mears
Harvard Medical School
January 24, 2013
Ryan P. Mears (Harvard Medical School) Automatic reports with knitr January 24, 2013 1/8
2. Background
Outline
1 Background
2 Automatic Reports
3 Other approaches with knitr
Ryan P. Mears (Harvard Medical School) Automatic reports with knitr January 24, 2013 2/8
3. Background
Rationale
Many data projects require much effort to improve signal/noise
Examples: image enhancement, optical character recognition,
MR imaging, electrophysiology, etc.
Unsupervised learning can assist efforts to remove artifacts.
Strategies: k-means, principal components, independent
components, etc.
Method: After classification select & remove likely noise sources
then compute criterion measures of data quality
Ryan P. Mears (Harvard Medical School) Automatic reports with knitr January 24, 2013 3/8
4. Background
Analysis Pipeline
Display Select Measure
1 Display Clustering result
2 Select features for further processing
3 Measure based on selection . . . repeat if under criterion
Ryan P. Mears (Harvard Medical School) Automatic reports with knitr January 24, 2013 4/8
6. Automatic Reports
A
LTEX templates: knitr parent & child documents
Slides are created from database cases.
Child document contains slide data & figure formatting.
A
Parent document contains LTEXdocument information.
Parent also contains code to iterate through database Page 1 of 1
ICselection_Parent.Rnw
cases.
Parent-child document structure separates content Printed For: ryan
Printed: 1/22/13 1:09:45 PM
from format.
<<run-all, results='hide', message=FALSE, echo=FALSE>>=
out = NULL
for (i in seq_len(75)) {
out = c(out, knit_child('ggchild-overlaypdf.Rnw', sprintf('template-%d.tex', i)))
}
<<write-results, message=FALSE,warning=FALSE,error=FALSE,echo=FALSE, results='asis'>>=
cat(out, sep = 'n')
@
end{document}
Ryan P. Mears (Harvard Medical School) Automatic reports with knitr January 24, 2013 6/8
8. Acknowledgements
Neurodynamics Lab
Yihui Xie (Creator of the knitr package)
Jeromy Anglim’s Blog (Psychology and Statistics)
Markus Gesmann (Mages’ Blog)
Ryan P. Mears (Harvard Medical School) Automatic reports with knitr January 24, 2013 8/8