R - capture.output(): save output into file (outputs from summary, lm, etc.)

15 Oct 2017

Similar to sink():

s <- summary(iris)
capture.output(s, file = "myfile.txt")

mod1 <- lm(size ~ day, data=myData)
capture.output(mod1, file = "myfile.txt")

[ R  function  ]