Skip to content

Rcmdr -> doItAndPrint -> summary method of S4-class object not in Rcmdr window but R Console

3 messages · Pfaff, Bernhard, Brian Ripley, John Fox

#
Dear list member,

John Fox proposed to me posting this problem to R-Help:

I have written a function suited for Rcmdr and included this in a R-file
located in Rcmdr/etc as well as an augmented `Rcmdr-menus.txt'.

Now, I am faced with the following problem:
method show() of a S4-class object works flawlessly, that is `doItAndPrint'
works flawlessly and its output is returned correctly into the Rcmdr-Window.
However, by using method summary() for the same S4-class object fails, in
the sense that the output is *not* printed in the Rcmdr window, but into the
R Console. The summary()-method contains cat() and slots of the S4-class
objects only.

My question is: How can it be achieved that method summary() of S4 objects
is printed in the RCmdr window and why, in the first instance, does it fail
to do so by using `doItAndPrint'.

Any help or pointer is much appreciated,

Best Regards
Bernhard

platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    2              
minor    0.1            
year     2004           
month    11             
day      15             
language R              
  



--------------------------------------------------------------------------------
The information contained herein is confidential and is inte...{{dropped}}
#
The FAQ Q8.1 does recommend that summary() methods do not print themselves 
but returned a classed object to be printed.

What doItAndPrint does is to capture the result of an explicit print, so 
it will only work for summary methods that follow that recommendation.

I do think doItAndPrint should be capturing all the output from a function 
via sink(), and not just the print of the final result.
On Mon, 22 Nov 2004, Pfaff, Bernhard wrote:

            

  
    
#
Dear Brian,
So that's it -- I should have seen that.
That would be better, wouldn't it. I'll try to figure out how to make that
work.

Thanks,
 John