On 10 Gru, 21:45, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Dec 10, 2007 12:26 PM, Andrzej Giniewicz <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > OK...
>
> > so I removed this file, and it is now never... well... seems that at
> > switch from experimental to optional something went wrong on my local
> > machine... now it says:
>
> > sage: import rpy
> > sage: rpy.r
>
> > ...
>
> > /opt/sage/local/lib/python2.5/site-packages/rpy.py in __repr__(self)
> > 321
> > 322 def __repr__(self):
> > --> 323 Rver = self.__getitem__('R_version_string')
> > 324 return "RPy version %s [%s]" % (rpy_version, Rver)
> > 325
>
> > /opt/sage/local/lib/python2.5/site-packages/rpy.py in
> > __getitem__(self, name)
> > 304 def __getitem__(self, name):
> > 305 # use r's 'get' function here, because the rpy one
> > only handles functions!
> > --> 306 obj = self.__dict__[name] = self.__dict__.get(name,
> > self.get(name))
> > 307 return obj
> > 308
>
> > <class 'rpy.RPy_RException'>: Error in function (x, pos = -1, envir =
> > as.environment(pos), mode = "any", :
> > variable "R_version_string" was not found
>
> > I remember I had same problem with experimental, I had to change
> > underscore to dot in name, and it was also on RPy mailing list for few
> > people... anyway I don't know if this is still some remaining part of
> > old version, or new... I'm going to build clean sage and then get this
> > package... will report back when it will be ready but it will take
> > some time...
>
> > sorry for troubles, didn't thought it can be old-file-problem,
>
> I'm sorry for the troubles you're having, and greatly appreciate
> that your testing the R spkg.]
no problem, whole pleasure on my side :)
> That rpy doesn't overwrite
> old files, etc., is something I'll have to keep in mind when we make
> new spkg's that include new versions of R and rpy -- we'll have
> to be careful to delete the old rpy files manually.
ok, so I build fresh sage 2.8.15, upgraded to get new singular, and
then installed r-2.6.1.p6, this ensures fresh environment for R...
unfortuneatlly I get:
sage: import rpy
sage: rpy.r
---------------------------------------------------------------------------
<class 'rpy.RPy_RException'> Traceback (most recent call
last)
/home/giniu/<ipython console> in <module>()
/opt/sage/local/lib/python2.5/site-packages/IPython/Prompts.py in
__call__(self,
arg)
521
522 # and now call a possibly user-defined print
mechanism
--> 523 manipulated_val = self.display(arg)
524
525 # user display hooks can change the variable to be
stored in
/opt/sage/local/lib/python2.5/site-packages/IPython/Prompts.py in
_display(self,
arg)
545 """
546
--> 547 return self.shell.hooks.result_display(arg)
548
549 # Assign the default display method:
/opt/sage/local/lib/python2.5/site-packages/IPython/hooks.py in
__call__(self, *
args, **kw)
132 #print "prio",prio,"cmd",cmd #dbg
133 try:
--> 134 ret = cmd(*args, **kw)
135 return ret
136 except ipapi.TryNext, exc:
/opt/sage/local/lib/python2.5/site-packages/IPython/hooks.py in
result_display(s
elf, arg)
160
161 if self.rc.pprint:
--> 162 out = pformat(arg)
163 if '\n' in out:
164 # So that multi-line strings line up with the left
column of
/opt/sage/local/lib/python2.5/pprint.py in pformat(self, object)
109 def pformat(self, object):
110 sio = _StringIO()
--> 111 self._format(object, sio, 0, 0, {}, 0)
112 return sio.getvalue()
113
/opt/sage/local/lib/python2.5/pprint.py in _format(self, object,
stream, indent,
allowance, context, level)
127 self._readable = False
128 return
--> 129 rep = self._repr(object, context, level - 1)
130 typ = _type(object)
131 sepLines = _len(rep) > (self._width - 1 - indent -
allowance)
/opt/sage/local/lib/python2.5/pprint.py in _repr(self, object,
context, level)
193 def _repr(self, object, context, level):
194 repr, readable, recursive = self.format(object,
context.copy(),
--> 195 self._depth,
level)
196 if not readable:
197 self._readable = False
/opt/sage/local/lib/python2.5/pprint.py in format(self, object,
context, maxleve
ls, level)
205 and whether the object represents a recursive
construct.
206 """
--> 207 return _safe_repr(object, context, maxlevels, level)
208
209
/opt/sage/local/lib/python2.5/pprint.py in _safe_repr(object, context,
maxlevels
, level)
290 return format % _commajoin(components), readable,
recursive
291
--> 292 rep = repr(object)
293 return rep, (rep and not rep.startswith('<')), False
294
/opt/sage/local/lib/python2.5/site-packages/rpy.py in __repr__(self)
321
322 def __repr__(self):
--> 323 Rver = self.__getitem__('R_version_string')
324 return "RPy version %s [%s]" % (rpy_version, Rver)
325
/opt/sage/local/lib/python2.5/site-packages/rpy.py in
__getitem__(self, name)
304 def __getitem__(self, name):
305 # use r's 'get' function here, because the rpy one
only handles
functions!
--> 306 obj = self.__dict__[name] = self.__dict__.get(name,
self.get(nam
e))
307 return obj
308
<class 'rpy.RPy_RException'>: Error in function (x, pos = -1, envir =
as.environ
ment(pos), mode = "any", :
variable "R_version_string" was not found
===========================================================
after I changed:
def __repr__(self):
Rver = self.__getitem__('R_version_string')
return "RPy version %s [%s]" % (rpy_version, Rver)
to
def __repr__(self):
Rver = self.__getitem__('R.version.string')
return "RPy version %s [%s]" % (rpy_version, Rver)
it worked, that's:
sage: import rpy
sage: rpy.r
RPy version 1.0.1 [R version 2.6.1 (2007-11-26)]
and WooHoo, with this modification it was mostly ok... I even tried to
do this in notebook:
=============================================
from rpy import *
r.png("test.png", bg="white", width=int(400), height=int(400))
r.hist(r.rnorm(1000))
r.dev_off()
=============================================
but got very strange result... is there some changes in workflow to
work with R from Sage? I got image in background AND whole lot of
numbers on top... I put it there: http://giniu.ravenlord.ws/test.png
also one question - as it's possible to install new packages from R
console, would new commands be somehow accessible from Sage or it
would need rebuild of RPy / change in Sage code?
Cheers,
Andrzej.
>
> -- William
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---