Hi,

 The class conversion example from section 4.3.2 of the
 manual demonstrates how to apply a conversion function
 to dataframes. However, I am having difficulty doing
 this for lists and vectors. In the example below the
 function is applied to the dataframe, but not to the
 list.

 The manual mentions that the class attribute of the
 obj is used. An R list does not have a class
 attribute, however the class() function returns
 'list'. What class string should I use?

 Thanks,

 Michael


 from rpy import *

 set_default_mode(CLASS_CONVERSION)
 def f(o):
     return 'works!'
 class_table['data.frame'] = f
 class_table['list'] = f

 r.as_data_frame([1,2,3])
 >>> works!

 r.list(c=[1,2,3], g=['w','r'])
 >>> {'c': [1, 2, 3], 'g': ['w', 'r']}

r.class_(r.list(c=[1,2,3], g=['w','r']))
 >>> list

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to