HTML vignettes crashing your RStudio? This may be the reason

Short version: if RStudio on Windows 7 crashes when viewing vignettes in HTML format, it may be because those packages specify knitr::rmarkdown as the vignette engine, instead of knitr::knitr and you’re using rmarkdown v1.

Longer version with details – read on.

update: looks like this issue relates to the installed version of rmarkdown (1.3 in my case) – see here for details.

HTML documentation for broom in RStudio

HTML documentation for broom in RStudio

At work I run RStudio (currently version 1.0.136) on Windows 7 (because I have no choice). This works:

  1. open the Packages tab
  2. click on broom
  3. click on User guides, package vignettes and other documentation
  4. click on HTML to see documentation for broom::broom


HTML documentation for dplyr in RStudio

HTML documentation for dplyr in RStudio

If I do the same for the dplyr package and choose the HTML documentation for dplyr::two-table, the results is not so pleasing (see image, right). Click on Debug for an uninformative message:

an unhandled win 32 exception occurred in rstudio.exe [10276].

Looking at the RMD source for the vignettes, we see that dplyr specifies knitr::rmarkdown for the vignette engine, whereas broom specifies knitr::knitr.

# dplyr
title: "Two-table verbs"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Two-table verbs}

# broom
<!-- %\VignetteEngine{knitr::knitr} %\VignetteIndexEntry{Introduction to broom} -->

Some further investigation suggests that the crash occurs for all packages where %\VignetteEngine{knitr::rmarkdown}, but not for those where %\VignetteEngine{knitr::knitr}. As it happens, I’ve just written a package which used knitr::rmarkdown (and crashed RStudio) and so was able to confirm that switching to knitr::knitr fixed the problem.