From Kurt.Hornik@ci.tuwien.ac.at  Mon Dec 13 09:15:07 1999
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Mon, 13 Dec 1999 10:15:07 +0100 (CET)
Subject: t.test inside function (PR#373)
In-Reply-To: <199912130906.KAA02783@pubhealth.ku.dk>
References: <199912130906.KAA02783@pubhealth.ku.dk>
Message-ID: <14420.47387.344162.756248@fangorn.ci.tuwien.ac.at>

>>>>> wsi  writes:

> Full_Name: Bill Simpson
> Version:  65.1 
> OS:  linux   
> Submission from: (NULL) (193.62.250.209)


> Try this code as separate lines entered interactively, then try doit()

> doit<-function()
> {
> x<-seq(1,10)
> y1<-x+rnorm(10,1,1.5)
> y2<-x+rnorm(10,1,1)
> t.test(x,y1,paired=TRUE)
> t.test(x,y2,paired=TRUE)
> }

> doit() apparently executes only the last of a series of t.test()s.

> Maybe this is no bug, but I can't see why this behaviour is shown.

What happens inside a function is not printed unless you ask for it.
You probably want something like

doit<-function()
{
x<-seq(1,10)
y1<-x+rnorm(10,1,1.5)
y2<-x+rnorm(10,1,1)
print(t.test(x,y1,paired=TRUE))
print(t.test(x,y2,paired=TRUE))
}

instead.

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


t.test inside function (PR#373)
Kurt Hornik