There is a package called 'safe' that produces an object which I can only write to a file using the sink() function. It works fine if the sink() command is not inside of a function, but it does not write anything to the file if the command is within a function.
Sample code: # Using a matrix because as a simple example. dumpMatrix = function(mat) { sink(file = "mat.txt") mat sink(NULL) } # This will write the file correctly. x = matrix(100, 10, 10) sink(file = "x.txt") x sink(NULL) # This will create an empty file. dumpMatrix(x) R 2.5.1 Windows XP, SP2 The sink() docs are full of warnings, but I'm not clear which one I've violated with this example. Dan ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.