[R] source code for dbeta

Mark Sharp msharp at txbiomed.org
Mon Jun 8 00:19:52 CEST 2015


Varun,

I apologize. I hit send before completing.

Look at the source document in the link I provided. dbeta is part of the stats package, which is part of the core R system and I do not think it is available as a standalone package. The linked document provides instructions for finding base R compiled code.

Mark

R. Mark Sharp, Ph.D.
msharp at TxBiomed.org
> On Jun 7, 2015, at 5:11 PM, Mark Sharp <msharp at TxBiomed.org> 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>
> 
> 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.
> msharp at TxBiomed.org
> 
> 
>> On Jun 7, 2015, at 4:31 AM, Varun Sinha <sinha.varuna85 at 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 at 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 at 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.



More information about the R-help mailing list