Hey Toby,
Thanks for the input, I'll try these things on tuesday (not to make anyone
jealous but I'm going to Bali for a long weekend in about 10 minutes :-D ).
The problems came up when I followed the steps in one of your .txt files...
I haven't had a chance to rigorously explore whats going on yet, and I'll
get right on to that when I get back!
As (another) aside I'm developing a reporting framework for django at the
moment, which I'd be keen to release to the community, and I think something
like dataplot would be a really good partner to that!! I'll be in touch -
sunburn not withstanding - when I get back! :-)
Ben

On 12/07/07, Toby Dylan Hocking <[EMAIL PROTECTED]> wrote:
>
>
> Hi Ben,
>
> I see what you're doing now. There are a couple things I should mention.
>
> First of all, you are right: getattr(r,'generic.scatter.plot') is not the
> same as typing r.generic.scatter.plot -- instead, it invokes the
> __getattr__ method of r, and looks for something by that name in the R
> namespace. Having found nothing, it raises an exception. If it did find
> something -- you'd have to rplot.source_for_function() or
> r.source("/path/to/generic.scatter.plot.R") first -- it would return the
> function, and assign it to r.generic_scatter_plot (rpy automatically
> translates R dots . to python underscores _ in variable names).
>
> It also looks like our package versions are significantly different. RPy
> is notoriously touchy about what particular package versions you are
> using, so that may be the cause of django.contrib.dataplot's failure on
> your system. But despite the differences in package versions, I bet that
> if you source the R code first, you will be able to execute the getattr
> properly, i.e.
>
> >>> from rpy import r
> >>> r.source
> ("/usr/local/lib/python2.4/site-packages/django/contrib/dataplot/R/generic.scatter.plot.R")
> {'visible': False, 'value': <Robj object at 0xb7e11190>}
> >>> r.generic_scatter_plot
> <Robj object at 0xb7e111a0>
>
> However, the whole point of django.contrib.dataplot is that it takes care
> of these details for you ---
>
> >>> from django.contrib import dataplot
> >>> plot=dataplot.Scatter('myscatterplot',fun_to_get_scatter_data)
> >>> plot.to_html()
>
> Have you tried to get the demo bike app (django.contrib.dataplot.bike) to
> work? If you are able to get those simple examples working, it should be
> straightforward to translate the design paradigm to your problems.
>
> Sincerely,
> Toby Dylan Hocking
> http://www.ocf.berkeley.edu/~tdhock
>
> On Thu, 12 Jul 2007, Ben Ford wrote:
>
> > Hi Toby,
> > My versions are:
> > R:            2.4.0
> > Python:   2.5.1
> > Rpy:        1.0-RC2
> >
> > Sorry I wasn't very clear earlier... I imported r into ipython to have a
> > play with it and see what happens. I tried getattr(r,'
> generic.scatter.plot')
> > which didn't work - I'm under the impression that getattr won't work
> with
> > dotted notation like that if you're doing normal object lookup, am I
> right
> > in saying that r does it differently to python? So i tried getattr(r,
> > 'generic') and that didn't work either. The error I get is:
> >> Error in get(x, envir, mode, inherits) : variable "generic.time.series"
> > was not found
> > I tried it with underscores too and I got exactly the same message...
> >
> > In fact just having looked through the source and having a play with rpy
> it
> > seems that there are bugs all over the place:
> >
> >>>> from rpy import r
> > RHOME= /usr/lib/R
> > RVERSION= 2.4.0
> > RVER= 2040
> > RUSER= /home/ben
> > Loading Rpy version 2040 .. Done.
> > Creating the R object 'r' ..  Done
> >>>> r
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File "/usr/lib/python2.5/site-packages/rpy.py", line 307, in __repr__
> >    Rver = self.__getitem__('R_version_string')
> >  File "/usr/lib/python2.5/site-packages/rpy.py", line 290, in
> __getitem__
> >    obj = self.__dict__[name] = self.__dict__.get(name, self.get(name))
> > rpy.RException: Error in get(x, envir, mode, inherits) : variable
> > "R_version_string" was not found
> >
> > It looks like the logic in R.__getattr__ isn't working properly! I'll
> > reinstall it at some point and see how it works :-)
> > Cheers
> > Ben
> >
> > On 12/07/07, Toby Dylan Hocking <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >> Hi Ben,
> >>
> >> I'm excited to hear that you got a copy of django.contrib.dataplot and
> you
> >> are trying it out. I will try to help you debug the problem, but the
> >> full traceback may be more useful. Can you send it?
> >>
> >> The purpose of the get_r_fun method is to look at the current R
> >> environment and check if the desired R function has been source'ed yet.
> >> This is one of the first steps before passing the data before R.
> >>
> >> I take the "r has no attribute generic" to refer to one of the generic
> >> plotting functions named in one of the RPlot subclasses -- you must be
> >> dealing with Scatter, TimeSeries, or NormalQQPlot, right? Are you sure
> it
> >> doesn't say something like "r has no attribute generic.scatter.plot"?
> You
> >> might try changing the dots . to underscores _ in the
> >> r_fun_name='generic.scatter.plot' line in the definition of the
> >> ScatterPlot subclass.
> >>
> >> Maybe your version of RPy isn't translating python names into R names
> the
> >> same way as mine is? I'm using RPy 0.4.6-3ubuntu2 Python 2.4.2-0ubuntu3
> >> and R 2.2.1-2 on ubuntu dapper. What are your versions?
> >>
> >> Sincerely,
> >> Toby Dylan Hocking
> >> http://www.ocf.berkeley.edu/~tdhock<
> http://www.ocf.berkeley.edu/%7Etdhock>
> >>
> >> On Wed, 11 Jul 2007, Ben Ford wrote:
> >>
> >>> Hi Toby
> >>> I've grabbed a copy of your code but the RPlot.get_r_fun method isn't
> >>> working for me... Could you perhaps explain how it does the mapping to
> >> the R
> >>> function? What my testing is saying to me is that r (the one that's
> >> imported
> >>> at the top of __init__.py) has no attribute generic... I've had a very
> >> brief
> >>> look at rpy before, but I'm not exactly familiar with it's inner
> >>> workings....
> >>> Great work, I've been meaning to have a crack at something like this
> for
> >>> ages!!
> >>> Ben
> >>>
> >>> On 11/07/07, Toby Dylan Hocking <[EMAIL PROTECTED]> wrote:
> >>>>
> >>>>
> >>>> Hi there,
> >>>>
> >>>> If you still need help with making data-driven plots, why don't you
> >> check
> >>>> out my new Django package --- I'd like some testers and comments.
> >>>> Basically it is an interface to the R programming language (for
> >> statistics
> >>>> and graphics) through the RPy package. You can download my latest
> >> release:
> >>>>
> >>>> http://www.ocf.berkeley.edu/~tdhock/dataplot-0.2.tgz<
> http://www.ocf.berkeley.edu/%7Etdhock/dataplot-0.2.tgz>
> >>>>
> >>>> I'm a statistician who has been using this system for some time at my
> >>>> work, but I finally am getting around to generalizing it and
> packaging
> >> it
> >>>> for general use with the Django framework.
> >>>>
> >>>> The installation instructions are in INSTALL.txt in the archive.
> >>>> Documentation is mostly present in docstrings at the moment -- I'm
> >> working
> >>>> on more tutorials, but the .txt files and the example app should be
> >> enough
> >>>> to get you started.
> >>>>
> >>>> Sincerely,
> >>>> Toby Dylan Hocking
> >>>> http://www.ocf.berkeley.edu/~tdhock<
> http://www.ocf.berkeley.edu/%7Etdhock>
> >>>>
> >>>>
> >>>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Regards,
> >>> Ben Ford
> >>> [EMAIL PROTECTED]
> >>> +628111880346
> >>>
> >>>>
> >>>
> >>
> >>>
> >>
> >
> >
> > --
> > Regards,
> > Ben Ford
> > [EMAIL PROTECTED]
> > +628111880346
> >
> > >
> >
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+628111880346

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to