Have you tried these operations in R itself?  I'm not sure that what
you're trying to do works in R, let alone R through python.

The error you're seeing is exactly correct - the R open function does
not know what to do with the character ("a") that you are passing to
it.

On Thu, Jan 27, 2011 at 2:46 PM, Wonsang You <wsg...@gmail.com> wrote:
> Sorry. I have to modify my question. My codes were exactly as follows.
>>
>> >>> import rpy2.robjects as robjects
>>
>> >>> load=robjects.r['load']
>>
>> >>> filename=robjects.StrVector(['test.RData'])
>>
>> >>> x=load(filename)
>>
>> >>> print(x)
>>
>> "a" "b" "c"
>>
>> >>> open(x[0])
>
> Afterward, I got the following error.
>>
>> RRuntimeError: Error in UseMethod("open") :
>>
>>  no applicable method for 'open' applied to an object of class "character"
>
> Wonsang
> 2011/1/27 Wonsang You <wsg...@gmail.com>
>>
>> Dear RPy2 users,
>> I would like to ask about how to use an R function from Python by using
>> RPy2 (http://rpy.sourceforge.net/). For example, I tried the following
>> Python codes.
>>>
>>> import rpy2.robjects as robjects
>>>
>>> open=robjects.r['open']
>>>
>>> filename=robjects.StrVector(['test.RData'])
>>>
>>> open(filename)
>>
>> However, I got the following error message.
>>>
>>> RRuntimeError: Error in UseMethod("open") :
>>>
>>> no applicable method for 'open' applied to an object of class "character"
>>
>> Can anyone suggest how to solve such an error? Thank you for your help.
>> Best Regards,
>> Wonsang You
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to