Skip to content
Prev 131968 / 398513 Next

XML R function description

Teodor --

Nice question! I don't think there is anything exactly like you are
looking for.

One problem is that in general R function arguments (and return
values) are not typed (!) and of course saying in the docs that a
function takes a particular type of argument is no guarantee that is
the case. A solution is to provide typing (e.g., via the TypeInfo
package in Bioconductor) or to restrict yourself to S4 methods (for
which at least some arguments are typed, though not generally return
values [though I believe they could be specified]).

A very different approach would recognize that R function arguments
are S-expressions of different types (raw, logical, character, int,
double, etc). Marking up R functions in XML then becomes the task of
(a) representing S-expressions or at least their content appropriately
(e.g., an important feature is to allow for NA; see StatDataML), (b)
identifying, perhaps on the fly since new packages are made available
all the time, functions to be exposed (with, e.g., 'get' and the
appropriate 'mode' argument), (c) determining the untyped signature
via 'formals', (d) creating an appropriate map between the (untyped)
signature and the XML representation of (a). This would mark up R
functions in XML without strong typing (i.e., with the level of type
specification currently available to R users!), but still seems,
naively, to be do-able.

I think it's worth asking whether you really want to expose 'all of R'
to C#, because this has significant security consequences (in a server
kind of environment) in addition to implicitly requiring use of the R
language semantics and evaluation model, and without some careful
thought needless movement of data across the R/C# boundary.

Mostly speculative ideas here, so please edit accordingly. Followup
definitely belongs in R-devel, where you might get some much more
informed input.

Others might suggest less exciting solutions, like (D)COM-based
packages referenced on the 'Other', packages, and FAQs links of the R
home page.

Martin

"Teodor Krastev" <Krustev at hotmail.com> writes:

  
    
Message-ID: <6ph8x3zqtix.fsf@gopher4.fhcrc.org>
In-Reply-To: <BAY120-DAV9DDB82E8DAF6A3A520020B76B0@phx.gbl> (Teodor Krastev's message of "Mon, 10 Dec 2007 12:36:25 -0500")