Hello,

in an effort to create a conversion between pandas objects[1] and R's 
data.frames, I'm trying to add columns to an empty DataFrame.

Python code:

from rpy2.robjects.packages import importr

base = importr("base")
my_row_names = 
empty = base.data_frame(row_names=[item for item in range(1000)] )

Problems arise when I try to add a column through the rx2 accessor:

empty.rx2["New"] = [str(item) for item in range(len(empty.rownames))]

RRuntimeError: Error in `[[<-.data.frame`(list(), "New", list("0", "1", "2", 
"3", "4",  :   argument "value" is missing, with no default

Anything I'm doing wrong? Or is there a more efficient way? (For reference, 
I'm trying to *avoid* creating taggedlists and so on because they involve 
intermediates, and with large objects that would mean performance issues).

[1] http://pandas.pydata.org


-- 
Luca Beltrame, Ph.D. - Translational Genomics Unit
Oncology Department, Mario Negri Institute

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to