Skip to content
Prev 316652 / 398506 Next

How does this function print, why is n1 which equals 1 printed as 2?

On Feb 1, 2013, at 7:47 AM, John Sorkin wrote:

            
1) on my machine the output from the cat() call is:

******n1*******= 1

2) All of the "output without any instructions in the function to  
print anything"  is just the value of the list object from the  
function. Unless you return values using the `invisible` function, any  
user define function executed at the console will print its value.  
That is standard interactive session behavior. So one gets after the  
the cat output:

$mu1
[1] 0

$mu2
[1] 8

$sd1
[1] 1.666667

$sd2
[1] 1.666667

$alpha
[1] 0.05

$n1
[1] 1

$n2
[1] 1

$power
[1] 0.8

$ratio
[1] 1

$table
   mu1 mu2      sd1      sd2 n1 n2
1   0   8 1.666667 1.666667  1  1

attr(,"class")
[1] "n.for.2means" "list"