[Rd] suggestion of new API function for embedded programming.

EBo ebo at sandien.com
Wed Sep 3 15:51:52 CEST 2008


While doing some embedded programming and trying to figure out how to generate
a hand coded SEXP equivalent of the line
"t.test(x,conf.level=(1-p))$conf.int[2]" I had an idea for an addition to the
embedded API.

There are a number of hidden or static parse functions (R_ParseBuffer,
R_Parse1Buffer, etc.) which take an IoBuffer* and returns a parsed tree.  If
one or more of these functions were exported to the Rembedded.h API we could
do something like the following:

  R_Expr = R_Parse1Buffer(&R_ConsoleIob, 0, &status);
  if (PARSE_OK==status) {
    ...
    value = eval(R_CurrentExpr, rho);
    ...
  }

or possibly simplifying the interface to take the CMDL string:

  R_Expr = R_Parse1Line("t.test(x,conf.level=(1-p))$conf.int[2]", &status);

I think this would be a useful addition to the embedding interface, and
hopefully not difficult to incorporate by someone more experienced with the
internals than I currently am.  I took a few hours to look into adding this
interface, but will not have time to try to do so for a few months -- I have a
couple of hard and fast deadlines over the next couple of weeks.  So, I would
like to make the suggestion and participate in the dialog.

  Best regards,

  EBo --

ps: if someone can suggest how to hand code
"t.test(x,conf.level=(1-p))$conf.int[2]" so I can embedd it I would be most
appreciative.



More information about the R-devel mailing list