Skip to content
Prev 274086 / 398506 Next

Help to write to a file

On Oct 11, 2011, at 1:03 PM, Sergio Ren? Araujo Enciso wrote:

            
You may need to print() that summary-object inside the for-function.

 > summary(a)
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
    1.00    1.75    2.50    2.50    3.25    4.00
 > sink("test.txt")
 > for(i in 1) summary(a)
 > sink()    # No test.txt file created
 > sink("test2.txt")
 > for(i in 1) print( summary(a) )
 > sink() # The expected file created

This relates to the FAQ about similar puzzling behavior with plotting  
lattice , grid or ggplot objects.
David Winsemius, MD
West Hartford, CT