Skip to content

Passing data to lm using RSPerl

1 message · Don MacQueen

#
Unfortunately, I have no experience with the syntax of RSPerl 
expressions within a perl script. But comparing the use of print(), 
that succeeded, with the use of lm(), which did not, I see something 
I think worth trying.

I would try this:

    &R::callWithNames( "lm", { 'r2 ~ r1' ,  @df }  );

because the third argument to lm() should be the data object itself. 
If you were doing this within R itself, the expressions you would 
write are

   print(name_of_dataframe)
   lm( r2~r1, name_of_dataframe)

So it seems to me that if
    &R::call( "print", @df);
is correct, then you would supply the data to lm() with an analogous 
syntax, i.e.,
    &R::callWithNames( "lm", { 'r2 ~ r1' , @df }  );

-Don
At 9:44 AM -0400 6/30/06, Adam Wizon wrote: