[R] Rcmdr -> doItAndPrint -> summary method of S4-class objectnot in Rcmdr window but R Console

John Fox jfox at mcmaster.ca
Mon Nov 22 14:08:07 CET 2004


Dear Brian,

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Prof 
> Brian Ripley
> Sent: Monday, November 22, 2004 5:57 AM
> To: Pfaff, Bernhard
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Rcmdr -> doItAndPrint -> summary method of 
> S4-class objectnot in Rcmdr window but R Console
> 
> 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.
> 

So that's it -- I should have seen that.

> I do think doItAndPrint should be capturing all the output 
> from a function via sink(), and not just the print of the 
> final result.
> 

That would be better, wouldn't it. I'll try to figure out how to make that
work.

Thanks,
 John

> On Mon, 22 Nov 2004, Pfaff, Bernhard wrote:
> 
> > 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}}
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> >
> >
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list