Can't knit notebook: Get "Error creating notebook: invalid regular expression"



I hope this is the right place to post…

I have just download RStudio (v for Windows (7) so that I can try R notebooks.

The “help box” gives the following version information:
Version 1.1.419 – © 2009-2018 RStudio, Inc.
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/538.1 (KHTML, like Gecko) rstudio Safari/538.1 Qt/5.4.1

The notebooks work, but I can’t get them to knit to anything. Whatever I try I get the error:
"Error creating notebook: invalid regular expression ‘(?<!(^|)``)r[ #]([^]+)\s*`’, reason ‘Invalid regexp’

Does anyone know what I’m doing wrong?

A web search shows up a few similar complaints from knitr, but they are supposed to be from a bug which is now fixed.

I have installed what I think are the latest versions of knitr (1.18) and blogdown (0.4).

I had to install the packages that were needed to create notebooks in the first place manually - the packages installed automatically didn’t have binaries for a late enough version.


OK I solved the problem.

It turned out the RStudio was picking up a rather old version of R on my computer (from 2014), rather than everything being a clean install as I’d thought.

With the latest version of R, it now works.