Dear All,

I'd like to trim the output produced in a Sweave code chunk. For instance, in

fit <- lm(conc ~ . - Plant, data = CO2)
summary(fit)

I'd like, skip the info after the coefficients' table, and possibly replace it with '...'.

I've created this small function to do this, which is based on capture.output():

trim.output <- function (x, lines, above = FALSE) {
    if (above)
        cat("\n...\n\n")
    cat(paste(x[lines], collapse = "\n"))
    cat("\n\n...\n")
}

out <- capture.output(summary(fit))
trim.output(out, 1:13)


but I was wondering if there is an *official* way to do this.


Thanks in advance.

Best,
Dimitris

--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web: http://www.erasmusmc.nl/biostatistiek/

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to