On Tue, 2 Sep 2008, David Hajage wrote:
I can't test it right now, but is this ok ?t.test.new <- function(x, y = NULL, alternative = c("two.sided", "less", "greater"), mu = 0, paired = TRUE, var.equal = FALSE, conf.level = 0.95, ...) { t.test(x, y, alternative, mu, paired, var.equal, conf.level, ...) }
You should name the arguments in the t.test call for safety. But just t.test.new <- function(..., paired = TRUE) t.test(..., paired=paired) is all you need, and for example allows formulae to be used.
2008/9/2 Prabhanjan Tattar <[EMAIL PROTECTED]>Hi R! I attempt to clear my question through this example. We know that the default functions for "t.test" is t.test(x, y = NULL, alternative = c("two.sided", "less", "greater"), mu = 0, paired = FALSE, var.equal = FALSE, conf.level = 0.95, ...) Suppose, I want to create a new function where "paired=TRUE". What is the simpler way of creating such functions? I did try, but without much success. Thanks in advance -- Prabhanjan N. Tattar Lead Statistician CustomerXPS Bangalore [[alternative HTML version deleted]] ______________________________________________ [email protected] 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.[[alternative HTML version deleted]] ______________________________________________ [email protected] 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.
-- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [email protected] 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.

