[R] Nested brew call yields Error in .brew.cat(26, 28) : unused argument(s) (26, 28)

Chris Beeley chris.beeley at gmail.com
Mon Apr 2 18:41:33 CEST 2012


Many thanks for this. I have a follow-up question. The output that I 
have from the nested brew call includes output like this:

NANANANANANANANAN

... then a graph or a table

... then more 
NANANANANANANANANNANANANANANANANANNANANANANANANANANNANANANANANANANAN

... etc.

It only occurs in the nested brew calls, not in the top level document, 
which is absolutely fine. There are functions defined in the top level 
file which the lower level files make use of. I assumed the problem was 
caused by my not understanding the documentation to do with nested brew 
calls; evidently this is not the case.

I have several functions within the top file, one for drawing graphs, 
one for tables, another for wordclouds, etc. They all generate this 
NANANANANANANA behaviour, I have tested by putting them in and out of 
the code.

I tried to produce a minimal self contained example containing a 
function defined in the top level file used by a file called in a nested 
brew: however this file worked fine.

I realise this isn't a lot to go on, but the functions are fairly long 
and it clearly isn't a specific issue with a particular function because 
they all do it. Has anyone else ever had this happen to them? If so did 
you find a solution (other than manually removing the NAs using a final 
piece of code, which admittedly is not too arduous).

Many thanks,
Chris Beeley,
Institute of Mental Health, UK


On 30/03/2012 02:27, Matt Shotwell wrote:
> 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 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.



More information about the R-help mailing list