Re: [R] a question of substitute

From: Adrian Dusa <dusa.adrian_at_gmail.com>
Date: Tue 09 Jan 2007 - 13:54:35 GMT

On Tuesday 09 January 2007 15:41, Prof Brian Ripley wrote:
> oneway.test expects a literal formula, not a variable containing a
> formula. The help page says
>
> formula: a formula of the form 'lhs ~ rhs' where 'lhs' gives the
> sample values and 'rhs' the corresponding groups.
>
> Furthermore, if you had
>
> foo.2 <- function() oneway.test(value ~ group)
>
> it would still not work, as
>
> data: an optional matrix or data frame (or similar: see
> 'model.frame') containing the variables in the formula
> 'formula'. By default the variables are taken from
> 'environment(formula)'.
>
> I could show you several complicated workarounds, but why do you want to
> do this?

Thank you for your reply. The data argument was exactly the next problem I faced. My workaround involves checking if(missing(data)) then uses different calls to oneway.test(). I am certainly interested in other solutions, this one is indeed limited.

I do this for the students in the anova class, checking first the homogeneity of variances with fligner.test(), printing the p.value and based on that changing the var.equal argument in the oneway.test() It's just for convenience, but they do like having it all-in-one.

Best regards,
Adrian

-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
          +40 21 3120210 / int.101

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed Jan 10 06:24:27 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 11 Jan 2007 - 01:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.