From Whit.Armstrong at tudor.com  Wed Dec 31 17:19:12 2003
From: Whit.Armstrong at tudor.com (Whit Armstrong)
Date: Wed Dec 31 17:25:29 2003
Subject: [Rd] Calling primitive functions from C code
Message-ID: <CD9BF92D5B1AD611ABEB00065B386FB0031F7070@tudor.com>

Does anyone have an example of calling primitive or internal functions from
C code that they would share with me?

I am having trouble trying to figure out how to construct the proper
arguments to pass to "do_subset_dflt"

Here is the prototype:
SEXP do_subset_dflt(SEXP call, SEXP op, SEXP args, SEXP rho);

The R_FunTab from "names.c" gives some additional information on the
arguments that the function expects.

{".subset",	do_subset_dflt,	1,	1,	-1,	{PP_FUNCALL,
PREC_FN,	  0}},

However, this is a little intimidating for someone like me who doesn't do
much C programming.

I understand that args is simply the argument list: x, rowsubset, colsubset,
drop, but the other variables are a mystery to me.

I've read the Appendix A R (internal) programming miscellanea from
R_exts.pdf, but there are no examples of calling these functions from C
code.
http://cran.r-project.org/doc/manuals/R-exts.pdf
<http://cran.r-project.org/doc/manuals/R-exts.pdf> 

How does one create call, op and rho to be passed into do_subset_dflt?

Any advice on constructing a successful call to do_subset_dflt from C would
be greatly appreciated.

Thanks,
Whit Armstrong


	[[alternative HTML version deleted]]


[Rd] Calling primitive functions from C code
Whit Armstrong