Jeff Johnson
2014-Jan-28 00:49 UTC
[R] KnitR/RMarkdown: Is there a way to not print a section of the document?
I've been looking through the R documents to see if there's a way to not output certain chunks of code. I'm trying to present a document to a team of folks that won't necessarily be interested in the line-by-line code, though they are interested in the charts, etc. Thus, I'd like to not output certain chunks of code. Is there a way to suppress sections? Thank you. -- Jeff [[alternative HTML version deleted]]
Luke Miller
2014-Jan-28 01:18 UTC
[R] KnitR/RMarkdown: Is there a way to not print a section of the document?
In the chunk options, you can use the argument echo = FALSE to suppress display of the R code in the output. << echo = FALSE>># R code @ This will still print out results from R that would be sent to the command line (like print() statements, cat() statements, results from summary(), etc), but the rest of the code in the chunk would be hidden from the output document. To make it easier to turn many code chunks on and off at once, define a variable as TRUE/FALSE early in the document, and then use that variable as the argument in the subsequent chunk options: <<echo = FALSE>>showcode = FALSE @ Every other chunk gets this argument: << echo = showcode>># R code. If showcode is FALSE, this code would be run, but not displayed in the output document. @ On Mon, Jan 27, 2014 at 4:49 PM, Jeff Johnson <mrjefftoyou at gmail.com> wrote:> I've been looking through the R documents to see if there's a way to not > output certain chunks of code. I'm trying to present a document to a team > of folks that won't necessarily be interested in the line-by-line code, > though they are interested in the charts, etc. Thus, I'd like to not output > certain chunks of code. Is there a way to suppress sections? > > Thank you. > > -- > Jeff > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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.-- ___________________________ Luke Miller
Duncan Mackay
2014-Jan-28 02:20 UTC
[R] KnitR/RMarkdown: Is there a way to not print a section of the document?
Hi I use Sweave and have a master Rnw file and parent files. If there are large chunks I split them up and then just put a % in front of the \SweaveInput if unwanted. Otherwise I split up the tex files with \input and \includeonly You could get into the chunk options and change things there but that is fiddly if you want to reuse Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mackay at northnet.com.au -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Jeff Johnson Sent: Tuesday, 28 January 2014 10:49 To: R help Subject: [R] KnitR/RMarkdown: Is there a way to not print a section of the document? I've been looking through the R documents to see if there's a way to not output certain chunks of code. I'm trying to present a document to a team of folks that won't necessarily be interested in the line-by-line code, though they are interested in the charts, etc. Thus, I'd like to not output certain chunks of code. Is there a way to suppress sections? Thank you. -- Jeff [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list 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.