[R] formula parsing, using parts ...
Russell Senior
seniorr at aracnet.com
Tue Oct 28 07:17:09 CET 2003
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?
--
Russell Senior ``I have nine fingers; you have ten.''
seniorr at aracnet.com
More information about the R-help
mailing list