On Wed, 2012-03-28 at 11:40 +0100, Chris Beeley wrote: > I am writing several webpages using the brew package and R2HTML. I would > like to work off one script so I am using nested brew calls. The > documentation for brew states that: > > "NOTE: brew calls can be nested and rely on placing a function named > ’.brew.cat’ in the environment in which it is passed. Each time brew is > called, a check for the existence of this function is made. If it > exists, then it is replaced with a new copy that is lexically scoped to > the current brew frame. Once the brew call is done, the function is > replaced with the previous function. The function is finally removed from > the environment once all brew calls return." > > I'm afraid I can't quite figure out what it is I'm supposed to do here. > I've tried loading the brew library within the script which I pass to > brew, and I've tried defining brew cat like this:
The paragraph above describes what brew is doing behind the scenes. It's not necessary to modify or set the .brew.cat function. A nested (or recursive) brew call occurs when brew() is called from a document currently being processed by brew(). To illustrate further, suppose there are two brew documents, example-1.brew and example-2.brew, where example-1.brew contains the following text (delimited by '''): ''' This text is in example-1.brew. <%= brew::brew("example-2.brew") %> ''' and the example-2.brew contains ''' This text is in example-2.brew. <%= date() -%> ''' Then from the R prompt we have: R>brew::brew("example-1.brew") This text is in example-1.brew. This text is in example-2.brew. Thu Mar 29 20:24:52 2012 > .brew.cat=function(){} > > This generates the following error message: > > Error in .brew.cat(26, 28) : unused argument(s) (26, 28) > > I think perhaps it is more likely that I need to insert into the script > the actual content of .brew.cat, but I can't seem to get R to tell me > what it is and Googling throws up a lot of stuff about beer and not much > else (drew a blank also from RSiteSearch("Nested brew")) > > Any help gratefully received. > > Chris Beeley > Institute of Mental Health, UK > > ______________________________________________ > R-help@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. -- Matthew S. Shotwell Assistant Professor, Department of Biostatistics School of Medicine, Vanderbilt University 1161 21st Ave. S2323 MCN Office CC2102L Nashville, TN 37232-2158 ______________________________________________ R-help@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.