I would like to know if there is something like r.assign('ROBJECT', PYTHONOBJECT) in rpy2...
I don't want to use R function to evaluate an object IN Python, I want to assign a matrix made in python to an R object... simone 2009/1/14 Simone Gabbriellini <simone.gabbriell...@gmail.com>: > [so sorry but I just answer your mail... I write to the list and you > answer to ME and to the list in CC... I have to remember to answer to > ALL to answer to the mailing list too... again, sorry for that, I > didn't mean to offend you] > > and thanks for the help > simone > > 2009/1/14 Laurent Gautier <lgaut...@gmail.com>: >> [why getting off the list ???] >> >> Simone Gabbriellini wrote: >>> >>> please do you have an example? >>> >>> because when I read "That import alone is sufficient to switch an >>> automatic conversion of numpy objects into rpy2 objects." I suppose >>> that every numpy object is seen by R... >> >> Automatic conversion of a numpy object: >> >> rlen = robjects.r['length'] >> print(rlen(gladj)) >> >> >> You are otherwise giving a *string* to be evaluated as R code >> (and R not looking into the python namespace when trying resolve a symbol). >> More on evaluating strings here: >> http://rpy.sourceforge.net/rpy2/doc/html/robjects.html?highlight=r_repr#strings-as-r-code >> >>> thank you, >>> simone >>> >>> 2009/1/14 Laurent Gautier <lgaut...@gmail.com>: >>>> >>>> Simone Gabbriellini wrote: >>>>> >>>>> yes, like that... >>>>> >>>>> but simply importing: >>>>> >>>>> Import rpy2.robjects.numpy2ri >>>>> >>>>> when I do: >>>>> >>>>> g1adj = numpy.array(g1adj) >>>>> >>>>> robjects.r('QAPset[1,,]<-g1adj') >>>> >>>> R has no way to know your Python variable called "gladj" unless you >>>> indicate >>>> it. >>>> >>>> print(robjects.r('ls()')) >>>> should confirm that there is no variable 'gladj' in your globalEnv. >>>> >>>> >>>>> it says: >>>>> >>>>> Error in eval(expr, envir, enclos) : object "g1adj" not found... >>>> >>>> The error message above is correct, I think. >>>> >>>>> while >>>>> in the docs it says that: >>>>> "That import alone is sufficient to switch an automatic conversion of >>>>> numpy objects into rpy2 objects." >>>>> >>>>> should I do something else? >>>>> >>>>> thank you, >>>>> simone >>>>> >>>>> 2009/1/14 Laurent Gautier <lgaut...@gmail.com>: >>>>>> >>>>>> Something like this >>>>>> http://rpy.sourceforge.net/rpy2/doc/html/numpy.html?highlight=numpy >>>>>> ? >>>>>> >>>>>> >>>>>> >>>>>> Simone Gabbriellini wrote: >>>>>>> >>>>>>> dear List, >>>>>>> >>>>>>> is it possible to pass a matrix I've built in python to R via rpy2? >>>>>>> >>>>>>> I'm sure I'm blind, but I cannot find example about how to pass object >>>>>>> from python to r, while I see how to pass object from r to python... >>>>>>> >>>>>>> best regards, >>>>>>> Simone Gabbriellini >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> This SF.net email is sponsored by: >>>>>>> SourcForge Community >>>>>>> SourceForge wants to tell your story. >>>>>>> http://p.sf.net/sfu/sf-spreadtheword >>>>>>> _______________________________________________ >>>>>>> rpy-list mailing list >>>>>>> rpy-list@lists.sourceforge.net >>>>>>> https://lists.sourceforge.net/lists/listinfo/rpy-list >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> This SF.net email is sponsored by: >>>>> SourcForge Community >>>>> SourceForge wants to tell your story. >>>>> http://p.sf.net/sfu/sf-spreadtheword >>>>> _______________________________________________ >>>>> rpy-list mailing list >>>>> rpy-list@lists.sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/rpy-list >>>> >> >> > ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list