[Rd] Another wishlist for R

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 26 16:41:00 MET 2004


On Mon, 26 Jan 2004, Duncan Murdoch wrote:

> On 26 Jan 2004 15:17:01 +0100, Peter Dalgaard
> <p.dalgaard at biostat.ku.dk> wrote :
> 
> >Either setup so that cat() will be used to print it (add class + print
> >method) or return noquote(....) The latter will give this effect:
> >
> >> noquote("function (x, y = NULL, type = \"p\", xlim = NULL, ylim = NULL, ")
> >[1] function (x, y = NULL, type = "p", xlim = NULL, ylim = NULL,
> >
> >i.e. include line numbers.
> 
> I think this produces a nice display:
> 
> > tail.function
> function (x, n = 6) {
>     lines <- matrix(deparse(x),ncol=1)

I would just use as.matrix(deparse(x)).

>     rownames(lines) <- 1:nrow(lines)
>     colnames(lines) <- ''
>     noquote(tail(lines,n=n))
> }
> 
> > tail(plot.default)
>                                                                    
> 36         box(...)                                                
> 37     if (ann)                                                    
> 38         title(main = main, sub = sub, xlab = xlab, ylab = ylab, 
> 39             ...)                                                
> 40     invisible()                                                 
> 41 }                        
> 
> Unfortunately, I doubt if people would really want the result to be a
> matrix, so maybe a new class is what is needed.

I knew this happened, but I did not know what people wanted.  I can only 
see this being used interactively (it at all: I would use page), so that 
seems as good as any.

-- 
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



More information about the R-devel mailing list