R is complaining because you handed the 'oneway' function a single
string parameter.

Instead of 
  oneway = robjects.r['oneway.test']
  test = oneway("values ~ ind, data=d, var.equal=TRUE")
try this:
  test = robjects.r['oneway.test(values ~ ind, data=d, var.equal=TRUE)']
or
  oneway = robjects.r['oneway.test']
  test = oneway("values ~ ind", data=d, var.equal=True)

-Greg

-----Original Message-----
From: Juls Night [mailto:julsni...@yahoo.com] 
Sent: Wednesday, April 08, 2009 11:38 PM
To: rpy-list@lists.sourceforge.net
Subject: [Rpy] Anova example

Hi,

I'm new to rpy2 and am trying out a few examples. I'm unfortunately
getting a
bit confused...

I've tried the example anova on the rpy2 document page and it works as
expected.
Now I'm trying to conduct an anova in a different way (and all I've
managed to
do is highlight my ignorance).

import rpy2.robjects as robjects

r = robjects.r

may=[2166, 1568, 2233, 1882, 2019]
sep=[2279, 2075, 2131, 2009, 1793]
dec=[2226, 2154, 2583, 2010, 2190]

d = r.stack(r.list(may=may,sep=sep,dec=dec))

robjects.globalEnv["d"] = d  # Is this necessary here?

oneway = robjects.r['oneway.test']
test = oneway("values ~ ind, data=d, var.equal=TRUE")

I get the following error message:

Error in function (formula, data, subset, na.action, var.equal = FALSE)
: 
  'formula' missing or incorrect
Traceback (most recent call last):
  File "<stdin>", line 14, in <module>
  File "/usr/lib/python2.5/site-packages/rpy2/robjects/__init__.py",
line 422,
in __call__
    res = super(RFunction, self).__call__(*new_args, **new_kwargs)
rinterface.RRuntimeError: Error in function (formula, data, subset,
na.action,
var.equal = FALSE)  : 
  'formula' missing or incorrect

Any help will be greatly appreciated!

-J


------------------------------------------------------------------------
------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to