On Sat, Jul 11, 2015 at 11:12 PM, Rich Shepard <rshep...@appl-ecosys.com> wrote: > On Sat, 11 Jul 2015, Liviu Andronic wrote: > >> Knitr seems to be picky about label names of figure chunks to be unique. >> Check this. Also, to be safe, keep to one figure per chunk. > > > Liviu, > > Yes, I read about naming lables; that's why knitr has the lp option for > label prefix. In my case, one lable is 'scatter plot group 1' and the other > is 'scatter plot group 2.' There is only one figure per chunk. > Not necessarily. There are LaTeX labels associated with figures; and knitr labels associated with chunks. The latter MUST be unique for figure chunks, while fig.lp seems to affect the former.
To be on the safe side, just manually ensure you have unique labels for figure chunks. >> As for the log, I think some knitr messages aren't in the log per se, but >> are displayed in the Messages pane. Inspect that for clues. > > > I didn't think of opening the message pane. Problems with the first figure > produced the LyX error window; these issues with the second figure do not > display that 2-window log message, only a fixed message that there's a > problem with the file. > > Here's the final portion of the message pane: > > 14:09:01.216: label: unnamed-chunk-8 > The figure chunk is unnamed. Better to use a chunk label. > 14:09:01.220: Quitting from lines 101-102 > (/tmp/lyx_tmpdir.iWjxUWQ26141/lyx_tmpbuf5/test.Rnw) 14:09:01.221: Error in > parse(text = x, srcfile = src) : 14:09:01.224: <text>:2:0: unexpected end > of input > 14:09:01.225: 1: xyplot(value ~ sampdate | variable, data=carlin.2.melt, > rm.na = T, ylab = 'Measured Value', xlab = 'Date' > 14:09:01.227: ^ > It's possible something is wrong in the code. Best I can say, experiment. Maybe you copied a ' from elsewhere, and it's not the ' flavor expected by R. Maybe something else is queer. Try to run the same code in your R session, etc. Sometimes it helps to export .Rnw or .tex, and inspect the offending chunks. > 14:09:01.229: Calls: knit ... <Anonymous> -> parse_all -> > parse_all.character -> parse > 14:09:01.231: 14:09:01.233: Execution halted > Systemcall.cpp (292): Systemcall: 'Rscript --verbose --no-save --no-restore > "/usr/share/lyx/scripts/lyxknitr.R" > "/tmp/lyx_tmpdir.iWjxUWQ26141/lyx_tmpbuf5/""test.Rnw" > "/tmp/lyx_tmpdir.iWjxUWQ26141/lyx_tmpbuf5/""test.tex" ISO-8859-15 > "/home/rshepard/documents/white-papers/water-chem-anal/"' finished with exit > code 1 > Error: Cannot convert file > ---------------------------------------- > An error occurred while running: > Rscript --verbose --no-save --no-restore "/usr/share/lyx/scripts/lyxknitr.R" > "/tmp/lyx_tmpdir.iWjxUWQ26141/lyx_tmpbuf5/""test.Rnw" > "/tmp/lyx_tmpdir.iWjxUWQ26141/lyx_tmpbuf5/""test.tex" ISO-8859-15 > "/home/rshepard/documents/white-papers/water-chem-anal/" > 14:09:07.510: Error while exporting format: PDF (pdflatex) > > Note line 227: the caret is under the 'x' in xyplot. > > Should I move this thread to the R-help list or stackexchange? > Possibly. This seems more knitr than LyX related. Liviu > Thanks, > > Rich > > -- Do you think you know what math is? http://www.ideasroadshow.com/issues/ian-stewart-2013-08-02 Or what it means to be intelligent? http://www.ideasroadshow.com/issues/john-duncan-2013-08-30 Think again: http://www.ideasroadshow.com/library