[R] Modifying Internal C Files

Ken Kelley KKIII at Indiana.Edu
Mon Nov 7 23:17:44 CET 2005


Hi All.
I want to tweak a few minor things inside of internal C code. I have my 
Win. XP machine set-up to build packages (including C code), but I'm 
having problems getting the package to run correctly. In particular, I 
want to modify a few things inside of pnbeta.c (namely errmax and 
itrmax), which is what the pbeta() function calls upon when there is a 
noncentral parameter. I copied the pnbeta.c C code, changed its name [to 
pnbeta2.c], included the nmath.h, dpq.h files, lgamma.c, and pbeta.c in 
my src folder (since the .h files were called upon and the .c files 
were). I then created an R function that I thought would call upon the 
new C code:

pnbeta2 <- function(x, a, b, lambda, low.tail, log.p)
{
res <- .C("pnbeta2", as.double(x), as.double(a), as.double(b), 
as.double(lambda), as.integer(low.tail), as.integer(log.p))
return(list(res))
}

But after I built the package and loaded it it, the function doesn't 
work (it isn't even recognized). I have no idea why this is failing. Any 
information to help me figure out what I need to do to modify internal C 
code generally, or specifically as it applies to this scenario would be 
most helpful.

Thanks,
Ken

-- 
Ken Kelley, Ph.D.
Inquiry Methodology Program
Indiana University
201 North Rose Avenue, Room 4004
Bloomington, Indiana 47405
http://www.indiana.edu/~kenkel




More information about the R-help mailing list