[R] Where to find the source codes for the internal function in stats package
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Sun Jan 18 00:01:02 CET 2009
Murray Cooper wrote:
> Dear Dr Murdoch,
>
> I understand in principle your explanation, but specifically where in the
> source distribution are these functions found? For instance, I would like
> to look at the code for model.matrix. Ex:
> ans <- .Internal(model.matrix(t, data))
>
> I have looked at the source distribution but been unable to locate the
> file which contains model.matrix.
... which suggests that either you lack stamina or the ability to use
search tools. It's not all that hard.
Anyways, the .Internal functions are dispatched via the table in
src/main/names.c, in this case to do_modelmatrix in src/main/model.c
[pd at titmouse2 R]$ find -name \*.c | xargs grep 'model\.matrix'
./src/main/model.c: warning(_("problem with term %d in model.matrix:
no columns are assigned"),
./src/main/names.c:{"model.matrix",do_modelmatrix, 0, 11, 2,
{PP_FUNCALL, PREC_FN, 0}},
[pd at titmouse2 R]$ find -name \*.c | xargs grep 'do_modelmatrix'
./src/main/model.c: /* and is ultimately called by do_modelmatrix. */
./src/main/model.c:SEXP attribute_hidden do_modelmatrix(SEXP call, SEXP
op, SEXP args, SEXP rho)
./src/main/names.c:{"model.matrix",do_modelmatrix, 0, 11, 2,
{PP_FUNCALL, PREC_FN, 0}},
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list