Hello everyone,
Just to let you know, what I did works fine. I simply copied all the R code
into Python and embraced it into triple double quotes r(""" xxx """) and
that looks elegant. I can also include good graphical library. Then I moved
all the code back to SPSS syntax (again very simple way) and that is my
black box for correspondence analysis, indscal analysis ... to be used in
the company by our analytical stuff with only basic spss information
skills. Thanks a lot to everyone! It all seems so simple now.
What do you think about this software chain, R to Python to SPSS? Is it
innovative or strange? Looks familiar to anyone? Widely used or unseen?
My boss just thought of that because he knew that it is possible and I had
to figure it out. This is the first time I do something like that. But I
like it now.
See you in next round,
Best,
Marko
On Mon, Dec 12, 2011 at 4:34 PM, Peter Cock <p.j.a.c...@googlemail.com>wrote:
> On Mon, Dec 12, 2011 at 3:18 PM, Marko Limbek <marko.lim...@valicon.net>
> wrote:
> > Thank you Peter, but with me it doesn't work,
> > as you can see from the printscreen in the attachment, that I send you.
> > I followed all four steps.
> > The warning in the picture says that variable resmca is not used.
> >
> > Marko
>
> You had this:
>
> set_default_mode(NO_CONVERSION)
> nv = r.data_frame(...)
> resmca = r.MAC(nv, ...)
> set_default_mode(BASIC_CONVERSION)
> c = r("resmca$var")
>
> which gave an exception: object 'resmca' not found.
>
> That is trying to tell you the object/variable 'resmca' does
> not exist in R. And it doesn't because you created it in
> Python instead. I think there is a way to assign variables
> in rpy but the syntax escapes me right now. What you
> can do (and it is NOT elegant) is just embed the R code
> as a long string for rpy to execute:
>
> set_default_mode(NO_CONVERSION)
> r("""
> nv <- data.frame(...)
> resmca <- MAC(nv, ...)
> """)
> set_default_mode(BASIC_CONVERSION)
> c = r("resmca$var")
>
> However, backtracking for a moment, what went
> wrong doing it the "proper" way though?
>
> http://rpy.sourceforge.net/rpy/doc/rpy_html/R-objects-look-up.html#R-objects-look-up
>
> Did you try this:
>
> set_default_mode(NO_CONVERSION)
> nv = r.data_frame(...)
> resmca = r.MAC(nv, ...)
> set_default_mode(BASIC_CONVERSION)
> resmca.var__ #guess from memory
>
> Also try:
>
> print dir(resmca)
>
> Peter
>
------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.
But none more important than the need to reduce IT complexity
while improving strategic productivity. Learn More!
http://www.accelacomm.com/jaw/sdnl/114/51507609/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list