Hi, I'm using Rpy2 and I'm trying to save a trained "glm" model, using the R "save" function. Unfortunately, it fails...
By example, running the following dummy example: ----------------------------------------------------------------------------------- import rpy2.robjects as ro import rpy2.rlike.container as rlc x = ro.FloatVector(range(10)) y = ro.FloatVector(range(10)) d = rlc.TaggedList([x,y], ['x','y']) data = ro.RDataFrame(d) fit = ro.r.glm(formula=ro.r('y ~ x'), data=data) output = ro.r.predict(fit, type='response') print 'fitted values:', list(output), '\n' ro.r.save(fit, file="glm.RData") ----------------------------------------------------------------------------------- produce: ----------------------------------------------------------------------------------- fitted values: [-9.9921611922069694e-16, 0.99999999999999922, 1.9999999999999996, 2.9999999999999996, 4.0, 5.0, 6.0, 7.0000000000000009, 8.0, 9.0000000000000018] Error in FUN("list(coefficients = c(-9.99216119220697e-16, 1), residuals = c(9.99216119220697e-16, 7.7715611723761e-16, 4.44089209850063e-16, 4.44089209850063e-16, 0, 0, 0, -8.88178419700125e-16, 0, -1.77635683940025e-15), fitted.values = c(-9.99216119220697e-16, 1, 2, 3, 4, 5, 6, 7, 8, 9), effects = c(-14.2302494707577, 9.08295106229248, 4.16225214017185e-16, 1.24249568966839e-16, -1.67726076083508e-16, -2.93168267440080e-16, -4.9960036108132e-16, -9.88141860003289e-16, -1.53696499971545e-15, -1.52135248843166e-15"[[1L]], : variable names are limited to 256 bytes Traceback (most recent call last): File "glm_example.py", line 12, in <module> ro.r.save(fit, file="glm.RData") File "/global/ia32/stow/python2.5-rpy2/lib/python2.5/site-packages/rpy2/robjects/__init__.py", line 422, in __call__ res = super(RFunction, self).__call__(*new_args, **new_kwargs) rinterface.RRuntimeError: Error in FUN("list(coefficients = c(-9.99216119220697e-16, 1), residuals = c(9.99216119220697e-16, 7.7715611723761e-16, 4.44089209850063e-16, 4.44089209850063e-16, 0, 0, 0, -8.88178419700125e-16, 0, -1.77635683940025e-15), fitted.values = c(-9.99216119220697e-16, 1, 2, 3, 4, 5, 6, 7, 8, 9), effects = c(-14.2302494707577, 9.08295106229248, 4.16225214017185e-16, 1.24249568966839e-16, -1.67726076083508e-16, -2.93168267440080e-16, -4.9960036108132e-16, -9.88141860003289e-16, -1.53696499971545e-15, -1.52135248843166e-15"[[1L]], : variable names are limited to 256 bytes ----------------------------------------------------------------------------------- Does anyone has an idea on how to avoid this problem, and why it is so??? Any clue would be much appreciate! Thanks. Réjean ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list