[R] rpy2 and user defined functions from R
collinl at cs.pitt.edu
Wed Oct 30 16:16:43 CET 2013
Erin, one question, can you access the defined functions by key?
In lieu of:
> x = R.r.buzz(3)
Can you do:
x = R.r['buzz'](3)
Alternatively if you need only one or two custom functions have you
considered just defining them via python as in:
PStr = """
S <- summary(LM);
F <- S$fstatistic;
P <- pf(F, F, F, lower=FALSE);
r_LMPValFunc = robjects.r(PStr)
On Tue, 29 Oct 2013, Erin Hodgess wrote:
> Hello again!
> I'm using python with a module rpy2 to call functions from R.
> It works fine on built in R functions like rnorm.
> However, I would like to access user-defined functions as well. For those
> of you who use this, I have:
> import rpy2.robjects as R
> R object as no attribute buzz
> (user defined function of buzz)
> This is on a Centos 5 machine with R-3.0.2 and python of 2.7.5.
> Thanks for any help.
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help