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 &lt;- .C(C_s_to_rp,
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; n = as.integer(nobs),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; nvarx = as.integer(nvar),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ncat = as.integer(cats* !isord),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; method= as.integer(method.int),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; as.double(unlist(controls)),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parms = as.double(unlist(init$parms)),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; as.integer(xval),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; as.integer(xgroups),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; as.double(t(init$y)),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; as.double(X),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; as.integer(!is.finite(X)), # R lets Infs through
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; error = character(1),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; wt = as.double(wt),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; as.integer(init$numy),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; as.double(cost),
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NAOK=TRUE)

Is this line calling the rpart.c function? 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,&nbsp; int nvarx, Sint *ncat, int method,&nbsp; int&nbsp; maxpri,&nbsp; double *parms,&nbsp; double *ymat,&nbsp; FLOAT *xmat, Sint *missmat, struct cptable *cptable, struct node **tree,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char **error,&nbsp;&nbsp; int *which, int xvals,&nbsp;&nbsp;&nbsp;&nbsp; Sint *x_grp,&nbsp;&nbsp;&nbsp; double *wt,&nbsp;&nbsp;&nbsp;&nbsp; double *opt, int ny,&nbsp; double *cost) 

----------------------
Thanks!




      
	[[alternative HTML version deleted]]

