Monthly Archives: October 2013

R Markdown tip: use Insert Chunk shortcut in RStudio

I have been using R Markdown more often in RStudio to prepare reproducible documents for our statistical consulting class. For R Markdown, we have to declare the start of a coding region by typing ```{r labelandoptions} and the end by ```. This becomes tedious when there are many coding regions. Fortunately, in RStudio, there is a Insert Chunk feature (Ctrl-Alt-I on PC and Cmd-Option-I on Mac) that automatically types this. It saves so much typing!

On a side note, it’d be great if a R Markdown document could be collapsed to only R code or only markdown, perhaps hiding the other with ellipses. This would help to analyze the R code or to see the flow of the document. If any RStudio developers read this, please consider it!