Dear Prof. Ripley,
Thank you for this extensive explanation. It looks like my first solution is
similar to (b): creating new variables inside the wrapper (and new data if
not missing).
This course is only introductory, with simple models, and I do point students
to each test separately if they
Looks like oneway.test has been changed for R 2.5.0.
Paste the code in this file:
https://svn.r-project.org/R/trunk/src/library/stats/R/oneway.test.R
into your session. Then fun.2 from your post will work without
the workarounds I posted:
fun.2(values ~ group)
On 1/9/07, Adrian Dusa
On Wednesday 10 January 2007 19:03, Gabor Grothendieck wrote:
Looks like oneway.test has been changed for R 2.5.0.
Paste the code in this file:
https://svn.r-project.org/R/trunk/src/library/stats/R/oneway.test.R
into your session. Then fun.2 from your post will work without
the
The 'Right Thing' is for oneway.test() to allow a variable for the first
argument, and I have altered it in R-patched and R-devel to do so. So if
your students can make use of R-patched that would be the best solution.
If not, perhaps you could make a copy of oneway.test from R-patched
Hi all,
I want to write a wrapper for an analysis of variance and I face a curious
problem. Here are two different wrappers:
fun.1 - function(formula) {
summary(aov(formula))
}
fun.2 - function(formula) {
oneway.test(formula)
}
values - c(15, 8, 17, 7, 26, 12, 8, 11, 16, 9, 16,
oneway.test is using substitute on its arguments so its literally
getting formula rather than the value of formula. Try these:
fun.3 - function(formula) {
mc - match.call()
mc[[1]] - as.name(oneway.test)
eval.parent(mc)
}
fun.3(values ~ group)
fun.4 - function(formula) {
On Tuesday 09 January 2007 15:14, Gabor Grothendieck wrote:
oneway.test is using substitute on its arguments so its literally
getting formula rather than the value of formula.
Ah-haa... I understand now. Thanks for the tips, they both work as expected.
Best,
Adrian
Try these:
fun.3 -
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)
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.