require(stats)
glmout <- capture.output(summary(glm(case ~ spontaneous+induced,
data = infert, family = binomial())))
glmout[1:5]
capture.output(1+1, 2+2)
capture.output({1+1; 2+2})
## Not run: ## on Unix-alike with a2ps available
# op <- options(useFancyQuotes=FALSE)
# pdf <- pipe("a2ps -o - | ps2pdf - tempout.pdf", "w")
# capture.output(example(glm), file = pdf)
# close(pdf); options(op) ; system("evince tempout.pdf &")
# ## End(Not run)
Run the code above in your browser using DataLab