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})
## on Unix-alike with a2ps available<!-- %% ?? pandoc with obeylines, obeyspaces -->
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 &")
<!-- % dont -->
Run the code above in your browser using DataLab