[R] Discovering methods

kjetil@entelnet.bo kjetil at entelnet.bo
Sat Nov 29 04:17:45 CET 2003


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?

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list