Hi the list,

I am writing a function (myFunc) that is using an other function (let say distance).

+++++++++++++++
dist1 <- function(x,y)dist(rbind(x,y))
dist2 <- function(x,y)y2

myFunc <- function(x,distance){
 cat("...\n")
 cat(distance(1,x))
}
myFunc(x=3,distance=dist1)
myFunc(x=3,distance=dist2)
----------------

In order to optimize the code, I would like to write myFunc in C. Is it possible, in the C code, to call a function define in R (dist1 or dist2) that will be send to myFunc as an argument ?

Christophe

______________________________________________
R-help@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.

Reply via email to