[R] looking at a function's code

Chuck Cleland ccleland at optonline.net
Mon Jul 16 14:26:03 CEST 2007


Walter Paczkowski wrote:
> Good morning,
> 
> 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>
> 
> 
> I expected to see several lines of R code.  Any suggestions?

  Have a look at:

https://svn.r-project.org/R/trunk/src/library/utils/R/head.R

  Also, ?head shows methods for different types of objects, and you can
see these with

getAnywhere(head.default)

or

utils:::head.default

> Thanks,
> 
> Walt Paczkowski
> 
> ______________________________________________
> R-help at 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list