import rpy

foo = rpy.r.list(a=1, b=2, c=3)
rpy.r["names"](foo)

tmp = rpy.r["names<-"](foo, ['d', 'e', 'f'])

rpy.r.str(tmp)
List of 3
 $ d: int 1
 $ e: int 3
 $ f: int 2


2008/6/11 Renato Alves <[EMAIL PROTECTED]>:
> Still can't get it to work... Am I missing something?
>
> b <- r("'rownames<-'")(b, a)
> TypeError: 'str' object is not callable
>
> I'm with RPy version 1.0.3 [R version 2.7.0 (2008-04-22)]
>
> Quoting Warnes, Gregory on 06/11/2008 05:34 PM:
>> Sorry, I gave you the wrong magic
>>
>> x <- r("'rownames<-'")(x, foo)
>>
>> -G
>>
>> On 6/11/08 12:01PM , "Renato Alves" <[EMAIL PROTECTED]> wrote:
>>
>>
>>> Hi Gregory,
>>>
>>> I've been trying to understand how to do the equivalent with the
>>> colnames function... without much success.
>>>
>>> I haven't been able to use your suggestion. I always get the error:
>>> unexpected '[' in "["
>>>
>>> Apart from this, is <- valid python syntax? Or did you meant to say = ?
>>>
>>> An example like this in the documentation would be very helpful.
>>>
>>> Thanks
>>>
>>> Quoting Gregory Warnes on 06/09/2008 05:42 PM:
>>>
>>>> As for changing he names on an existing object, you can't use the
>>>> rownames(x) <- foo syntax trick in python.  Internally R converts
>>>> function calls of this sort to
>>>>
>>>> "[<-rownames"(x, foo)
>>>>
>>>> Given this fact, you can use
>>>>
>>>> x <- r("[<-rownames")(x, foo)
>>>>
>>>> to change the rownames.
>>>>
>>>> -G
>>>>
>>> -------------------------------------------------------------------------
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://sourceforge.net/services/buy/index.php
>>> _______________________________________________
>>> rpy-list mailing list
>>> rpy-list@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/rpy-list
>>>
>>
>>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to