Here's an alternative, even simpler:
foo2 <- capture.output(write.csv(matrix(1:6,nrow=2), stdout(), row.names=F))
foo2
## "\"V1\",\"V2\",\"V3\"" "1,3,5" "2,4,6"
Perhaps you want to:
foo2[-1,]
## "\"V1\",\"V2\",\"V3\"" "1,3,5" "2,4,6"
dash2 source
share