Search code examples
rlatexknitrlyxtikz

Using tikzDevice in lyx doesn't work


I am trying to include a histogram created with qplot(ggplot2) with the code chunk

<<histAge, echo = F, message = F, warning = F, dev='tikz'>>=
  plot(hist.age)
@

It works just fine with dev='pdf', but doesn't work with dev='tikz'. The library tikzDevice is installed in R, tikz is included in the lyx document.

In case it matters, hist.age is a qplot with geom histogram.

The message in lyx says somewhere

Error in system(latexCmd, intern = T, ignore.stderr = T) : 'C:\Program' not found".

Overall error is Error: Cannot convert file.

I would really appreciate any help to make this work!


Solution

  • This should be an issue that has been reported earlier this year. Before the next version of tikzDevice (> 0.8.1) is on CRAN, you need to install the development version:

    devtools::install_github('yihui/tikzDevice')
    

    Since you are on Windows, you will need RTools.