Hi, Thanks a lot. I downloaded the tar.gz file and I found the C code.
I would really appreciate it if you could field another question: I have to use sql, and I have to perform various statistical calculations - like integrate, dbeta etc. Sql does not have these functions, plus they are very difficult to code. Would it be possible to use the C code, compile it and deploy it in sql? Is that feasible, or even permitted? Thanks once again, I'm very grateful. On Mon, Jun 8, 2015 at 2:06 AM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 07/06/2015 6:11 PM, Mark Sharp wrote: > > Varun, > > > > If you type dbeta at the command line you get the R source, which in > this case tells you that the code is calling a compiled source. This is > indicated by the line <bytecode: 0x7fc3bb1b84e0> > > No, that says that the R code (what is shown) is compiled. What > indicates that this is C code is the use of .Call. The C_dbeta and > C_dnbeta objects are "NativeSymbolInfo" objects that hold the pointers > to the C entry points. > > Since it is in a base package ("stats"), the source is in the R sources, > somewhere in https://svn.r-project.org/R/trunk/src/library/stats/src. > You can search through those files for the dbeta or dnbeta functions. > The "C_" prefix is conventionally used in the R sources to indicate that > it is C code; generally you replace it with "do_" in the actual C code. > This particular function is actually not really in the package source; > it's in the main part of the R sources, in file > > https://svn.r-project.org/R/trunk/src/nmath/dbeta.c > > (though it takes a few steps to get there, starting in the stats package > function do_dbeta). > > Duncan Murdoch > > > > See the following. > >> dbeta > > function (x, shape1, shape2, ncp = 0, log = FALSE) > > { > > if (missing(ncp)) > > .Call(C_dbeta, x, shape1, shape2, log) > > else .Call(C_dnbeta, x, shape1, shape2, ncp, log) > > } > > <bytecode: 0x7fc3bb1b84e0> > > <environment: namespace:stats> > > > > Compiled code in a package > > > > If you want to view compiled code in a package, you will need to > download/unpack the package source. The installed binaries are not > sufficient. A package's source code is available from the same CRAN (or > CRAN compatible) repository that the package was originally installed from. > The download.packages() function can get the package source for you. > > > > Extracted from > http://stackoverflow.com/questions/19226816/how-can-i-view-the-source-code-for-a-function > > > > Mark > > > > > > R. Mark Sharp, Ph.D. > > msh...@txbiomed.org > > > > > >> On Jun 7, 2015, at 4:31 AM, Varun Sinha <sinha.varun...@gmail.com> > wrote: > >> > >> Hi, > >> > >> I am trying to find the source code for dbeta function. > >> > >> I tried edit(dbeta) and this is what I got: > >>> edit(dbeta) > >> function (x, shape1, shape2, ncp = 0, log = FALSE) > >> { > >> if (missing(ncp)) > >> .Call(C_dbeta, x, shape1, shape2, log) > >> else .Call(C_dnbeta, x, shape1, shape2, ncp, log) > >> } > >> <environment: namespace:stats> > >> > >> It looks like it is calling calling C_dbeta, but I'm not sure. If it > does, > >> how do I find it's source code? > >> > >> Thank you! > >> Varun > >> > >> [[alternative HTML version deleted]] > >> > >> ______________________________________________ > >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> 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. > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.