I ran these two code blocks, expecting the same output
cattest <- file("cattest.txt")
cat("First thing", file = cattest)
cat("Second thing", file = cattest, append = TRUE)
close(cattest)
sink("cattest_sink.txt")
cat("First thing")
cat("Second thing")
sink()
But the resulting cattest.txt
contains only "Second thing", whereas the cattest_sink.txt
includes what I expected, "First thingSecond thing". Why is the append
argument ignored with the file connection?
I'm on 64bit R 3.0.1 on Windows, in case it matters.