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):
    #this function should be called for class conversion        
    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



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to