[Rd] Fwd: Digest package - make digest generic?

hadley wickham h.wickham at gmail.com
Tue Oct 16 22:22:31 CEST 2007


On 10/16/07, Roger Peng <rdpeng at gmail.com> wrote:
> My understanding was that Hadley wanted 'digest' to operate on part of
> an object rather than on the entire, which might contain uninteresting
> or irrelevant details.  For example, if we had
>
> a <- structure(list(x = 1, y = 2), class = "foo")
> b <- structure(list(x = 2342342, y = 2), class = "foo")
>
> digest.foo <- function(object, ...) digest(object$y)

Yes, that's exactly what I want, except in my case my objects contain
about 20 or 30 bits of information that are irrelevant (I'm my case
documentation about the class and other functions), so it would be
surprising if p1 and p2 which produced identical plots gave different
digests.

If you want the default behaviour, you could always call
digest.default to digest the entire object.

Hadley



More information about the R-devel mailing list