[R] using the sink() function in a for-look

Johannes Hüsing johannes at huesing.name
Thu May 1 11:44:49 CEST 2008


Rolf Turner <r.turner at auckland.ac.nz> [Thu, May 01, 2008 at 06:59:29AM CEST]:
> 
> On 1/05/2008, at 4:40 PM, Johannes Hüsing wrote:

[...]
> >
> >When you do the following:
> >
> >for (i in 1:100) {
> >    summary(rnorm(80))}
> >
> >what output do you get?
> 
> 	He'd get nothing at all.
> 

That's the point.

> 	Did you ***try*** your code?
> 
> >And all this output
> 
> 	``All this output''!  Consisting of the empty set !!!
> 

Hm, I thought this group would be mathematically inclined enough not
to single out the empty set as a special case.

> >is redirected to your file by sink(), so it works
> >as expected.
> 
> 	That all depends on what you expect, I guess.  

I upgraded my expectations after keying ?sink and reading. 

> Most people
> 	would expect to get some output.  As Tony expected.
> 

I readily concede that your answer was taking it easier on the
beginner than mine.
-- 
Johannes Hüsing               There is something fascinating about science. 
                              One gets such wholesale returns of conjecture 
mailto:johannes at huesing.name  from such a trifling investment of fact.                
http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")



More information about the R-help mailing list