Hello,

I am new to RPy (and R in general) and am having trouble getting
started. I'm performing a linear regression as follows:

        r = robjects.r
        xVec = robjects.FloatVector(X)
        yVec = robjects.FloatVector(Y)
        robjects.globalEnv["xVec"] = xVec
        robjects.globalEnv["yVec"] = yVec
        reg = r.lm("xVec ~ yVec")
        
        print(r.summary(reg))

This works like a charm, although I am a little confused at why I need
to declares my vectors into the global R namespace. However, my real
problem is dealing with the results. For example, I can obtain the
adjusted r squared value as follows:

summary = r.summary(reg)
aRR = summary.r["adj.r.squared"]

Now, print(aRR) gives me:

$adj.r.squared
[1] 0.1106428

My question is how do I get at the actual value 0.1106428. I would
have thought aRR[0] would do the trick, but this just returns an
RVector. Obviously I am missing something fundamental here. Thanks for
any and all help.

Thanks,
Donovan

------------------------------------------------------------------------------
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to