On 2013-03-14 23:20, David Haynes wrote:
Hello,
I have a general question about writing outputs to a file.
Specifically I am using the lme function in R to generate a model. The
print r.summary(model) function works fine. However, I would like to
capture that in a text file.
Right now the error I receive is this.
ValueError: Buffer for this type not yet supported.
The full traceback would be helpful (it would tell where the error is
originating from).
I have tried the sink function in R as well. It opens a file, but it
does not close it and nothing is being written in it.
http://stat.ethz.ch/R-manual/R-patched/library/base/html/sink.html
This is most probably an issue with R (and how sink() is called), not rpy2.
Otherwise, the function summary() is returning an R object of class
'table'.
When printing it from rpy2, Python is calling str() on the objects. You
can just write this in a file from Python:
s = robjects.r('summary(attenu, digits = 4)')
with open("/tmp/foo.txt", "w") as f:
f.write(str(s))
Thanks
d = {'groups': robjects.IntVector(groups), 'weight':
robjects.FloatVector(weight), 'y': robjects.FloatVector(y)}
dataf = robjects.DataFrame(d)
r.attach(dataf)
##bayes.lme(Formula("y ~1"), random = Formula('~1'))
rs = bayes.lme(Formula("y ~1"), random = Formula('~1 |
groups'),weights = Formula("~1/weight"))
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list