

makeNamesTs are unexported functions from the stats namespace. # No method found for function "extract" and signature SpatialPolygons #Error in getMethod("extract", signature = "SpatialPolygons") : It will not suffice to supply the partial signature getMethod("extract",signature="SpatialPolygons") getMethod("extract", signature = c( x = "Raster", y = "SpatialPolygons") ) To see the source code for one of these methods the entire signature must be supplied, e.g. There are also methods with more complex signatures for each method, for example require(raster) GetMethod can be used to see the source code of one of the methods: > getMethod("chol2inv", "diagonalMatrix") The method to see defined S4 methods is offered helpfully: > showMethods(chol2inv) standardGeneric is an indicator of an S4 function. The output already offers a lot of information. Use showMethods("chol2inv") for currently available ones. StandardGeneric for "chol2inv" defined from package "base" Here is an example of an S4 function: > library(Matrix) The S4 system is a newer method dispatch system and is an alternative to the S3 system.

Registered S3 method for t from namespace stats print.ts time.ts* [ getAnywhere(t.ts)Ī single object matching ‘t.ts’ was found monthplot.ts* na.omit.ts* Ops.ts* plot.ts diffinv.ts* diff.ts kernapply.ts* lines.ts The S3 method dispatch systemįor S3 classes, you can use the methods function to list the methods for a particular generic function or class. UseMethod("t") is telling you that t() is a ( S3) generic function that has methods for different object classes. How can I find the source code for those? Primitive function does? Similarly, some functions call. > matrixįunction (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL) In still other cases, there's a bit of R code, but most of work seems to be done somewhere else. makeNamesTs(.), dframe = dframe, union = TRUE) In other cases, I can see that R functions are being called, but I can't find the source code for those functions. Use showMethods("with") for currently available ones. Methods may be defined for arguments: data StandardGeneric for "with" defined from package "base" Is there a difference between when I see UseMethod and when I see standardGeneric and showMethods, as with with? > with In this case, what does UseMethod("t") mean? How do I find the source code that's actually being used by, for example: t(1:10)? I know I can print a function by typing its name at the prompt: > t

I want to look at the source code for a function to see how it works.
