def test_eval_very_convoluted_function_result(): """ The result of this call is a highly nested data structure. Have fun on evaluation it! """ res = conn.r('x<-1:20; y<-x*2; lm(y~x)') assert res.__class__ == TaggedList # check which tags the TaggedList has: assert res.keys == ['coefficients', 'residuals', 'effects', 'rank', 'fitted.values', 'assign', 'qr', 'df.residual', 'xlevels', 'call', 'terms', 'model'] assert compareArrays(res['coefficients'], TaggedArray.new(numpy.array([-0., 2.]), ['(Intercept)', 'x']))
def test_eval_very_convoluted_function_result(): """ The result of this call is a highly nested data structure. Have fun on evaluation it! """ res = conn.r('x<-1:20; y<-x*2; lm(y~x)') assert res.__class__ == TaggedList # check which tags the TaggedList has: assert res.keys == [ 'coefficients', 'residuals', 'effects', 'rank', 'fitted.values', 'assign', 'qr', 'df.residual', 'xlevels', 'call', 'terms', 'model' ] assert compareArrays( res['coefficients'], TaggedArray.new(numpy.array([-0., 2.]), ['(Intercept)', 'x']))
def test_tagged_array(): res = conn.r('c(a=1.,b=2.,c=3.)') exp_res = TaggedArray.new(numpy.array([1., 2., 3.]), ['a', 'b', 'c']) assert compareArrays(res, exp_res) assert res.keys() == exp_res.keys() # compare the tags of both arrays