From dmurdoch at pair.com  Mon Jan 26 15:42:24 2004
From: dmurdoch at pair.com (Duncan Murdoch)
Date: Mon Jan 26 15:44:10 2004
Subject: [Rd] Another wishlist for R
In-Reply-To: <x2wu7eu74y.fsf@biostat.ku.dk>
References: <Pine.LNX.4.44.0401241416280.11292-100000@gannet.stats>
	<4012A99F.8030004@pburns.seanet.com>
	<pq5a10pn7b6itfnkga71fbggqa6crsds1o@4ax.com>
	<x2wu7eu74y.fsf@biostat.ku.dk>
Message-ID: <4j9a101n98647k6b7kag6jh1isnk135c25@4ax.com>

On 26 Jan 2004 15:17:01 +0100, Peter Dalgaard
<p.dalgaard@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)
    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.

Duncan Murdoch


[Rd] Another wishlist for R
Duncan Murdoch