[R] Discovering methods
Gabor Grothendieck
ggrothendieck at myway.com
Sat Nov 29 05:05:59 CET 2003
Sure, but why are some methods found using methods("POSIXct")
while other methods not found?
It would be nice to have some reliable documentation-independent
way to discover all the methods for a class.
---
Date: Fri, 28 Nov 2003 23:17:45 -0400
From: <kjetil at entelnet.bo>
To: <R-help at stat.math.ethz.ch>, <ggrothendieck at myway.com>
Subject: Re: [R] Discovering methods
On 28 Nov 2003 at 16:27, Gabor Grothendieck wrote:
How would I discover that + is a method for POSIXct? Applying
methods() to POSIXt and POSIXct does not reveal it.
Reading
?POSIXct
will tell you.
Kjetil Halvorsen
> methods(class="POSIXt")
[1] as.character.POSIXt cut.POSIXt diff.POSIXt
[4] hist.POSIXt julian.POSIXt months.POSIXt
[7] quarters.POSIXt seq.POSIXt str.POSIXt
[10] weekdays.POSIXt
> methods(class="POSIXct")
[1] [.POSIXct [[.POSIXct [<-.POSIXct
[4] all.equal.POSIXct as.data.frame.POSIXct c.POSIXct
[7] format.POSIXct mean.POSIXct plot.POSIXct
[10] print.POSIXct rep.POSIXct summary.POSIXct
Applying methods() to "+" does give it but, in general, this
would not be a feasible way to discover it since it would be
tantamount to trying everything possible:
> methods("+")
[1] +.POSIXt
Is there some other way?
More information about the R-help
mailing list