[R] calling C function from R
Uwe Ligges
ligges at statistik.tu-dortmund.de
Thu May 29 17:47:26 CEST 2008
What you have sent is almost unreadable.
Please do not send HTML messages (as the posting guide suggests)!
Wen-Ching Lin wrote:
> Hi,
>
> I am reading the source code of rpart. I have problems understand the following code and would appreciate for any helps. In rpart.s, there is a line:
>
> rpfit <- .C(C_s_to_rp,
> n = as.integer(nobs),
> nvarx = as.integer(nvar),
> ncat = as.integer(cats* !isord),
> method= as.integer(method.int),
> as.double(unlist(controls)),
> parms = as.double(unlist(init$parms)),
> as.integer(xval),
> as.integer(xgroups),
> as.double(t(init$y)),
> as.double(X),
> as.integer(!is.finite(X)), # R lets Infs through
> error = character(1),
> wt = as.double(wt),
> as.integer(init$numy),
> as.double(cost),
> NAOK=TRUE)
>
> Is this line calling the rpart.c function?
There is no rpart.c function. It is just a file that contains some C code.
In fact, you should look for the "s_to_rp" entry point.
> If so, what was sent to rpfit? I am confused because rpart.c only returns an integer, not an object. The following is the rpart.c function:
>
> int rpart(int n, int nvarx, Sint *ncat, int method, int maxpri, double *parms, double *ymat, FLOAT *xmat, Sint *missmat, struct cptable *cptable, struct node **tree, char **error, int *which, int xvals, Sint *x_grp, double *wt, double *opt, int ny, double *cost)
It is just a declaration.
Uwe Ligges
> ----------------------
> Thanks!
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list