On 08/05/10 06:26, John Owens wrote:
> Using the new function "from_csvfile" on a DataFrame is terrific. I'd like to
> extend this in two ways:
>
> 1) I have three csv files, let's say a.csv, b.csv, c.csv. I'd like to import 
> all
> three and put them into one DataFrame. How can I do this? They all have the 
> same
> columns.

http://rpy.sourceforge.net/rpy2/doc-2.1/html/robjects.html#rpy2.robjects.vectors.DataFrame.rbind

> 2) When I do this, I'd also like to add a new column that's the name of the
> source file. So for instance, I'd like an additional "source" column, and the
> lines from a.csv would be labeled 'a' in that column and so on.

http://rpy.sourceforge.net/rpy2/doc-2.1/html/robjects.html#rpy2.robjects.vectors.DataFrame.cbind


Not much else in the documentation, so you'll have to look at the unit 
tests for a code example:
http://www.bitbucket.org/lgautier/rpy2/src/tip/rpy/robjects/tests/testDataFrame.py#cl-104



L.


> Would be delighted if I could figure out either or both of these. Thanks!
>
> JDO
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------

_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to