Gary Strangman wrote:
> Hi again,
> 
> I have a list-of-lists that I want to convert to an R dataframe. (In R, it 
> should end up as 306 rows by 12 columns.) The rpy2 instructions suggested 
> in this forum were basically: (1) convert my list of lists to a list of 
> array.array()s, (2) convert each array.array() to an RVector, (3) convert 
> the list of RVectors to a TaggedList, and (4) convert the taggedlist to a 
> RDataFrame. While a touch unwieldy, that all works fine ... in most cases.

I have been undecided regarding the amount of guessing / wrappers rpy2 
should provide.
Going through a TaggedList is currently the way to go, but depending on 
the feedback 2.1 could have this revised slightly.

> However, I have some datasets with string columns in my source data 
> (categorical data). These cannot be converted by array.array(), as it 
> doesn't accept strings. TaggedList appears to work fine (as shown below) 
> if I skip step 1 above and create RVectors straight from lists. But when I 
> convert a TaggedList created a list of RVectors created this way, I get 
> one LONG dataframe (1 row by 12*306=3672 columns):


You can use the class StrVector for vectors.
(briefly mentioned at 
http://rpy.sourceforge.net/rpy2/doc/html/robjects.html#creating-vectors)



L.


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to