[R] Translating lm.object to SQL, C, etc function

j+rhelp@howard.fm j+rhelp at howard.fm
Fri Feb 14 09:02:03 CET 2003

On Fri, 14 Feb 2003 08:31:58 +0100, "Uwe Ligges"
<ligges at statistik.uni-dortmund.de> said:
> j+rhelp at howard.fm wrote:
> > So my question is, how do I export an lm.object in some form that I can
> > then apply to prediction in C, SQL, or some other language? All I'm
> > looking for is some well-structured textual or data frame output that I
> > can then manipulate with appropriate tools, whether it be S itself, or
> > something like Perl.

> See ?dump

Thanks for the suggestion. After my last post I tried switching from
SPLUS to R and discovered the useful xlevels attribute, which when output
with expression(), combined with the coefficients attribute, gives me the
information I need. dump() also provides those things, although it has a
lot of other stuff not needed to build the prediction function.

I'll start coding something using this, but it won't be ideal. The two
problems are:
 - The variable name / level name are still concatenated with
   no delimiter in the coefficients, so it's possible there will
   be ambiguous names
 - It feels rather clunky to be relying on these attributes when
   I feel like I should be adding methods directly to the class

In SPLUS I came across a useful attribute 'assign', which has a mapping
of term names to variables - the same attribute in R doesn't appear to
provide this information. Is this available somewhere?

What approaches are others using to apply their models to data sets where
S is not available? Has anyone written any convertors of models to other
languages? Is it possible to compile an expression or model into a DLL or
COM object and access it that way? I'm aware of the SOAP interface, but
that doesn't really suit our needs in this case.


More information about the R-help mailing list