On Fri, 3 Jul 2015, Scott Kostyshak wrote:

Let's take this step-by-step. First, I strongly recommend using knitr
over Sweave (this is not just a personal preference). If you go to
Help > Specific Manuals > Knitr and compile, does it work?

Scott,

  That's certainly a brief manual. :-)

If so, now let's see how to add knitr to a new document. Above you said
that there is no Sweave article class. Indeed, because you can add it to
any class as a module. Go to Document Settings > Modules and add the "Rnw
(knitr)" module. Click "Add" and then "OK".

  Oops! The knitr package was not installed; now it is.

No in your document, either use ERT like in the knitr manual (try just
copying over the junk), or what I recommend is to use the knitr Chunk
environment. To do this latter, go to Insert > Custom Insets > Chunk
(this is now there because you've added the module).  After you add the
chunk, try just putting in "rnorm(5)". That's it, no beginning <<>>= and
no ending @. The chunk inset does that for you.

  Here's the chunk:

<<show-off>>=
rnorm(5)
@

and here's the tail of the messages when I tried compiling with pdflatex:

0:15:51.950: output file:
/tmp/lyx_tmpdir.pbeypZM21263/lyx_tmpbuf0/water-chemistry-analyses.tex
10:15:51.952: 10:15:51.954: [1]
"/tmp/lyx_tmpdir.pbeypZM21263/lyx_tmpbuf0/water-chemistry-analyses.tex"
10:15:51.961: pdflatex  "water-chemistry-analyses.tex"
10:15:52.030: This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013
on Slackware (SlackBuilds.org))
10:15:52.032:  restricted \write18 enabled.
10:15:52.081: entering extended mode
10:15:52.082: (./water-chemistry-analyses.tex
10:15:52.084: LaTeX2e <2011/06/27>
10:15:52.086: Babel <3.9f> and hyphenation patterns for 78 languages loaded.
10:15:52.088: 10:15:52.393: Error while exporting format: PDF (pdflatex)Systemcall.cpp
(292): Systemcall: 'pdflatex  "water-chemistry-analyses.tex"' finished with
exit code 1

  So, now it's knitr doc reading time.

Rich

Reply via email to