z1
is a ListVector
containing one FloatVector
with one element:
>>> z1
<ListVector - Python:0x4173368 / R:0x36fa648>
[FloatVector]
p.value: <class 'rpy2.robjects.vectors.FloatVector'>
<FloatVector - Python:0x4173290 / R:0x35e6b38>
[0.050000]
You can extract the float itself with z1[0][0]
or just float(z1[0])
:
>>> z1[0][0]
0.05
>>> type(z1[0][0])
<type 'float'>
>>> float(z1[0])
0.05
In general you are going to have an easier time figuring out what is going on in an interactive session if you just supply the name of the object you want a representation of. Using print x
statement transforms things through str(x)
when the repr(x)
representation used implicitly by the interactive loop is much more helpful. If you are doing things in a script, use print repr(x)
instead.