Calling multicomp from within a fxn

Brian P. Flaherty (bxf4@email.psu.edu)
Wed, 28 Jan 1998 21:03:49 -0500


Dear S-Plus Users,

I thought I was getting better at this kind of thing, but I cannot
figure this one out. I have a function which will compute a
Kruskal-Wallis and an omni-bus ANOVA. Then, if the p-value of the ANOVA
is below a cut-off, I want to run multicomp() on the results of the
particular ANOVA. Here is part of my function:

print(kruskal.test(y, groups))
tmp.aov <- aov(formula = y ~ groups)
print(anova(tmp.aov))
if(summary(tmp.aov)[1, 5] <= alpha) multicomp(tmp.aov))

When I run this, it crashes at multicomp(tmp.aov), and it says that it
can't find y. I assume that this means it is evaluating multicomp in a
different frame, but I cannot figure out how make it evaluate in the
correct frame. I tried:

eval(expression(multicomp(tmp.aov)), parent=sys.parent(1))

but that did not work either.

I am running S-Plus 4, release 2 on Windows NT.

Thank you for your time and any suggestions.

Brian Flaherty