Walter Paczkowski: > I'd like to look at the code for the R function head. When I type just > the word head, I get back > > function(x, ...) > UseMethod("head") > <environment: namespace:utils>
This basically means that 'head' is a generic function that works in different ways for different classes of objects (data frames, matrices, tables &c.) Many function, e.g., 'plot' and 'mean', work the same way. Type ?UseMethod for a better/longer explanation. Now type methods(head) You will get: [1] head.data.frame* head.default* head.ftable* head.function* [5] head.matrix head.table* Now, ordinarily you should be able to write 'head.data.frame' to see the code for this function, but, since it is starred, '*', this doesn't work. The easiest way to get hold of it is using 'getAnywhere': getAnywhere(head.data.frame) -- Karl Ove Hufthammer ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.