HTML vignettes crashing your RStudio? This may be the reason

[This article was first published on R – What You're Doing Is Rather Desperate, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

# 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.


Filed under: R, statistics Tagged: debug, rstudio, software, windows

To leave a comment for the author, please follow the link and comment on their blog: R – What You're Doing Is Rather Desperate.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)