我有一个R对象定义为
seasonal = list(order = c(0, 0, 0), period = scalar)
我需要在等效对象中转换为在Rpy2中传递。请帮忙。
答案 0 :(得分:0)
from rpy2.robjects.vectors import ListVector, IntVector
# if the order of the element does not matter
seasonal = ListVector({'order': IntVector((0,0,0)), 'period': scalar})
# if the order matters
seasonal = ListVector([('order', IntVector([0,0,0])),
('period', scalar)])
文档中至少提到ListVector
:
http://rpy2.readthedocs.org/en/version_2.7.x/vector.html?highlight=listvector#assigning-python-style