I am writing a little abstraction for a series of tests. For example, I am running an anova and kruskal.test on a one-factor model. That isn't a particular problem, I have an interface like:
my.function <- function(model,data) { print(deparse(substitute(data))) a <- anova(lm(formula,data)) print(a) if(a$"Pr(>F)"[1] < 0.05) { pairwise.t.test(???) } b <- kruskal.test(formula,data) print(b) if ... }
I want to run each test, then depending on the resulting p-value, run pairwise tests. I am getting into trouble where I put the ??? above. The pairwise.t.test has a different interface, that seems to want me to dismember the formula into constituent parts to feed in. The other alternative is to give my.function the constituent parts and let it build the model. I haven't figured out how to do either one. Can someone give me some pointers?
See ?formula and its "See Also" Section on how to do formula manipulation. There's also an example on how to construct a formula.
Uwe Ligges
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help