TECH TIP: Dynamic Documents with R and knitr

Print Friendly, PDF & Email


I spent this evening at a very enjoyable and educational event with the Los Angeles Area R Users Group (data science) Meetup. As I’ve mentioned in prior Field Reports, this group has well very thought-out presentations and well-chosen presenters. There were two separate presentations for tonight. The first talk was by Josh Wiley, senior analyst at Elkhart Group Ltd., who told us how to prepare dynamic documents allowing for results and graphs from analyses to be dynamically embedded in documents. The need for dynamic documents is to facilitate reproducible research results since you can publish the dynamic documents for other researchers to use in reviewing and reproducing your experimental results. The knitr package allows R code to be written along with documents in many formats such as markdown, LaTeX, and HTML.

Dynamic documents reduce human error copying and pasting results, save time when updating numbers and graphs, and make code more comprehensible by embedding it with the document where it is used. I have not personally used dynamic documents but I do see the need for this process and I will give it a try sometime soon.

The second talk tonight was by Jeremy Miles, quantitative psychologist at the RAND Corporation, whose presentation was “Let’s do statistics backwards: Structural Equation Modeling in R.” Structural equation modeling (SEM) is a powerful tool for testing complex hypotheses. In SEM you start with a model (represented in a path diagram) and test it on the data; rather than the more common starting with the data and developing a model. SEM requires that you do statistics backwards. But SEM allows you to think about models in different ways, and test complex hypotheses that cannot (easily) be tested using other methods. In this talk, Jeremy explained why you should be excited about SEM. His slides can be downloaded HERE.

I encourage all budding data scientists to seek out and join your local Meetup groups in this and related fields so you can enjoy meeting like-minded people and learn new techniques as much as I do. Please report back here with your experiences.




Speak Your Mind