[R] How to find where the source code of an R function or package is installed?

David Winsemius dwinsemius at comcast.net
Sun Nov 29 05:59:26 CET 2009



On Nov 28, 2009, at 11:00 PM, Peng Yu wrote:

> I'm wondering where is the source of an R function or a package is.
> For example, where is 'attributes'?
>
>> attributes
> function (obj)  .Primitive("attributes")
>
> I also do understand what .Primitive mean.

Looking below, it appears your understanding is different than mine.

> Could somebody let me know
> how to locate source file in an R installation?

Most R installations do not have the source code. But it is of course  
available.

https://svn.r-project.org/R/branches/R/src/main/

> Why typing
> 'attributes' does not give its definition?

Because it's a .Primitive? ... which to me anyway means it is not  
implemented in R code.

>
> ______________________________________________
> R-help at r-project.org 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list