Peng Yu
2009-Nov-29 04:00 UTC
[R] How to find where the source code of an R function or package is installed?
I'm wondering where is the source of an R function or a package is. For example, where is 'attributes'?> attributesfunction (obj) .Primitive("attributes") I also do understand what .Primitive mean. Could somebody let me know how to locate source file in an R installation? Why typing 'attributes' does not give its definition?
Sharpie
2009-Nov-29 04:44 UTC
[R] How to find where the source code of an R function or package is installed?
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. Could somebody let me know > how to locate source file in an R installation? Why typing > 'attributes' does not give its definition? > >A call to .Primitive() means that the function hands off execution to internal code in the R environment. This internal code is most likely in the form of a compiled C or Fortran function. To see what happens inside a .Primitive() call, you will have to start digging into the R source code. I think a good place to start may be to download and unpack the R source and then look at: R-2.x.y/src/main/names.c Which contains a table mapping .Primitive() and .Internal() calls to their c-level counterparts. Good luck! -Charlie -- View this message in context: http://n4.nabble.com/How-to-find-where-the-source-code-of-an-R-function-or-package-is-installed-tp930625p930631.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2009-Nov-29 04:59 UTC
[R] How to find where the source code of an R function or package is installed?
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
jim holtman
2009-Nov-29 05:55 UTC
[R] How to find where the source code of an R function or package is installed?
Check out: Uwe Ligges. R Help Desk: Accessing the sources. R News, 6(4):43-45, October 2006 On Sat, Nov 28, 2009 at 11:00 PM, Peng Yu <pengyu.ut at gmail.com> 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. Could somebody let me know > how to locate source file in an R installation? Why typing > 'attributes' does not give its definition? > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?