Hi Rich, I have no idea wha that chunk is not working but I think you can get the same result using the old method Stick the following in an ERT (Insert > Tex Code) <<set-ops, echo = FALSE>>opts_chunk$set(echo = FALSE) @ Heck, I've only been using LyX for 4-5 years and already I'm sounding crotchety. John Kane Kingston ON Canada> -----Original Message----- > From: rshepard at appl-ecosys.com > Sent: Mon, 20 Jul 2015 12:58:51 -0700 (PDT) > To: r-help at r-project.org > Subject: Re: [R] Knitr: setting echo = FALSE globally > > On Mon, 20 Jul 2015, Thierry Onkelinx wrote: > >> We need the source file. > > Attached to the original message was the TeX output called, > 'sample.txt'. > I've attached it again, but with the .tex extension. Also, the .lyx file > is > attached. > > Rich > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
On Mon, 20 Jul 2015, John Kane wrote:> I have no idea wha that chunk is not working but I think you can get the > same result using the old method Stick the following in an ERT ... > > <<set-ops, echo = FALSE>>> opts_chunk$set(echo = FALSE) > @> Heck, I've only been using LyX for 4-5 years and already I'm sounding > crotchety.John, Crotchety is appropriate for situations like this. The above _almost_ works. Attached three PDF files show the results of tests, all with the LaTeX code inserted. sample-no-chunk.pdf: removing chunk2 with its contents, opts_chunk$set(echo=FALSE), did not keep the R code from displaying. sample-chunk-2-above.pdf and sample-chunk-2-below.pdf: chunk2 was prior to, and following, the LaTeX code and all other R code did not echo, only the chunk2 code displayed. Thanks, Rich -------------- next part -------------- A non-text attachment was scrubbed... Name: sample-no-chunk.pdf Type: application/pdf Size: 69845 bytes Desc: URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150721/7bff7fa4/attachment.pdf> -------------- next part -------------- A non-text attachment was scrubbed... Name: sample-chunk-2-above.pdf Type: application/pdf Size: 68938 bytes Desc: URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150721/7bff7fa4/attachment-0001.pdf> -------------- next part -------------- A non-text attachment was scrubbed... Name: sample-chunk-2-below.pdf Type: application/pdf Size: 68938 bytes Desc: URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150721/7bff7fa4/attachment-0002.pdf>
On Mon, 20 Jul 2015, John Kane wrote:> I have no idea wha that chunk is not working but I think you can get the > same result using the old method Stick the following in an ERT box: > > <<set-ops, echo = FALSE>>> opts_chunk$set(echo = FALSE) > @John, My original response was too large (3 attached PDF files) and was held for moderator approval which is no longer needed. I found the magic solution; looks awkward, but it works. Near the top of the document (well before any R code) I insert a knitr chunk containing the directive, opts_chunk$set(echo=FALSE). This is immediately followed by an ERT box as above. The double whammy prevents R code from echoing ... except for the contents of the leading chunk itself. Adding the option, echo=FALSE, to that leading chunk prevents it from displaying. Note that both the chunk with opts_chunk$set() and the ERT is required to prevent R code from displaying. No chunk but ERT box does not stop the echoing. Thanks for the pointer, Rich