is it possible to redirect console output to a variable?

I believe results <- capture.output(…) is what you need (i.e. using the default file=NULL argument). sink(textConnection(“results”)); …; sink() should work as well, but as ?capture.output says, capture.output() is: Related to ‘sink’ in the same way that ‘with’ is related to ‘attach’. … which suggests that capture.output() will generally be better since it is more contained … Read more