[R] Knitr: setting echo = FALSE globally [RESOLVED]
John Kane
jrkrideau at inbox.com
Tue Jul 21 17:36:15 CEST 2015
Hi Rich,
It sounds like your approach with the chunks is equivalent to my approach. Somewhere I remember reading that the global chunk commands apply to everything 'after' the global command--which once one thinks about it is sensible .
Glad it's working. R +knitr does save a lot of time once you get it working.
John Kane
Kingston ON Canada
> -----Original Message-----
> From: rshepard at appl-ecosys.com
> Sent: Tue, 21 Jul 2015 08:30:09 -0700 (PDT)
> To: r-help at r-project.org
> Subject: Re: [R] Knitr: setting echo = FALSE globally [RESOLVED]
>
> 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
>
> ______________________________________________
> 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.
____________________________________________________________
Publish your photos in seconds for FREE
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4
More information about the R-help
mailing list