Faisal Moledina wrote: > On Tue, Dec 1, 2009 at 5:34 PM, Laurent Gautier <lgaut...@gmail.com> wrote: >> This is an involuntary omission. >> >> The rpy2.robjects.lib.ggplot2 module started out as a way to show how to map >> Python classes onto R classes manually (not matter what flavour of R OOP is >> used). >> (I have updated the documentation recently about that >> http://rpy.sourceforge.net/rpy2/doc-dev/html/robjects.html#working-with-r-s-oops) >> >> Since you are already using rpy2-2.1dev (thanks for that, btw), you can work >> around the missing bits by using importr(). >> >> Example: >> from rpy2.robjects.packages import importr >> >> ggplot2_pack = importr("ggplot2") >> ggplot2_pack.theme_set(ggplot2_pack.theme_bw()) >> >> (more about importr() at >> http://rpy.sourceforge.net/rpy2/doc-dev/html/robjects.html#module-rpy2.robjects.packages) > > Ah, this makes more and more sense. I could use importr to import > ggplot2 and have access to all its R internals from python. Now I > think understand why only ggplot2 and grid are in the robjects.libs.
Yes. The ones in robjects.lib are manual and mappings of the ggplot2 classes and function into Python classes and function (that's why you can call a method plot()... rather can call a function print()). Using importr() is directly giving you access to the R functions in the package (with the only following niceties on a Python perspective: - objects in the package can be explicitly called. ggplot2 = importr('ggplot2') ggplot2.ggplot() rather than fishing the first thing in the search path that matches "ggplot" (and not necessarily the one from the packages ggplot2) with: robjects.r["ggplot"]() > This is great, I'll definitely be using this going forward. Thanks > again for your help, Laurent, and thanks for rpy2! Please continue reporting what does work like it seems it should along the way. L. > Faisal ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list