1

I type this code in LyX:

<<>>=
data$y <- data$x
@

This code makes an error, because the "$$" makes the content inside them interpreted as a math formula. Is there anyway to contour this problem?

tonytonov
  • 25,060
  • 16
  • 82
  • 98
Miracula
  • 53
  • 3

1 Answers1

2

Put the code in a TeX box. To do this, highlight all of the text and go to Insert > TeX Code (default shortcut is ctrl + l).

If you happen to be using LyX 2.1 beta, go to help > specific manuals > knitr to see an example.

Don't forget that you must have the module loaded. To do this, go to Document > Settings > Modules

scottkosty
  • 2,410
  • 1
  • 16
  • 22