[R] sink() within a function?

From: Jon Stearley <jrstear_at_sandia.gov>
Date: Thu 02 Jun 2005 - 01:49:14 EST


sink() isn't behaving as i expect, when used inside a function, eg:

   x<-data.frame(F=c("O","O"))
   f<-"foo.txt"
   sink(f); format(x); sink(); # foo.txt looks great!    foo<-function(x,f) { sink(f); format(x); sink(); }    foo(x,f=f) # foo.txt is empty!
why is this, and how can i successfully sink() within a function?

my real function does some rearrangement and formatting, but the above illustrates the problem i'm encountering. thx in advance for any help!

    [MacOS 10.3, R 2.0.1]

-- 
+--------------------------------------------------------------+

| Jon Stearley (505) 845-7571 (FAX 844-9297) |
| Sandia National Laboratories Scalable Systems Integration |
+--------------------------------------------------------------+ one more clue: library(debug); mtrace(foo); foo(x,f=f); ... # foo.txt is not empty! ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Jun 02 02:02:56 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:20 EST