An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101220/f7a7b232/attachment.pl>
finding and opening C source called from R functions.
3 messages · Chiquoine, Ben, Peter Langfelder, Duncan Murdoch
On Mon, Dec 20, 2010 at 12:48 PM, Chiquoine, Ben <BChiquoine at tiff.org> wrote:
Hi,
As will soon be very clear I'm an R novice. ?I'm trying to better understand the ks.test function in the stats package. ?When I look at the source code there are several calls to C functions (for example .C("pkstwo", is.integer(length(x[IND])), p=as.double(x[IND]), as.double(tol), PACKAGE = "stats)$P). ?I'm wondering if there is a way to view the source code for the underlying C functions? ?I googled a post which said to open ks.c to see the source code but I can't find that file anywhere on my hard drive or on the web. ?Any suggestions would be greatly appreciated.
Go to cran.r-project.org, find the package stats, download the tar.gz bundle, unpack it (on a linux command line, you can type tar -xvzf stats*.tar.gz), then navigate to the directory stats/src and look at the source code in the directory.
On 20/12/2010 3:56 PM, Peter Langfelder wrote:
On Mon, Dec 20, 2010 at 12:48 PM, Chiquoine, Ben<BChiquoine at tiff.org> wrote:
Hi,
As will soon be very clear I'm an R novice. I'm trying to better understand the ks.test function in the stats package. When I look at the source code there are several calls to C functions (for example .C("pkstwo", is.integer(length(x[IND])), p=as.double(x[IND]), as.double(tol), PACKAGE = "stats)$P). I'm wondering if there is a way to view the source code for the underlying C functions? I googled a post which said to open ks.c to see the source code but I can't find that file anywhere on my hard drive or on the web. Any suggestions would be greatly appreciated.
Go to cran.r-project.org, find the package stats, download the tar.gz bundle, unpack it (on a linux command line, you can type tar -xvzf stats*.tar.gz), then navigate to the directory stats/src and look at the source code in the directory.
In many cases that will work, but not in this one: stats is a base package, so there is no tar.gz bundle. See Uwe Ligges' article in R News on how to find source in general. It's in http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf and I think it is all still current. Duncan Murdoch