From Kurt.Hornik at wu-wien.ac.at  Sun Aug  1 17:07:20 2004
From: Kurt.Hornik at wu-wien.ac.at (Kurt Hornik)
Date: Sun Aug  1 20:56:10 2004
Subject: [Rd] directing print.packageInfo to a file
In-Reply-To: <loom.20040726T011220-264@post.gmane.org>
References: <loom.20040726T011220-264@post.gmane.org>
Message-ID: <16653.1832.118387.608204@mithrandir.hornik.net>

>>>>> Gabor Grothendieck writes:

> There was a discussion on r-help of getting the output from 
> print.packageInfo into a file.  Spencer and I have added a file=
> argument to print.packageInfo for consideration in R.  Had this
> been available it would have simplified the answer to that
> thread.  If the file= argument is used then the packageInfo
> information is sent to the file specified rather than displayed
> using file.show .

What is wrong with

	capture.output(print.packageInfo(x, ...), file = NULL)

for what you want?

-k

> print.packageInfo <- function (x, ..., file = NULL) 
> {
>     if (!inherits(x, "packageInfo")) 
>         stop("wrong class")
>     outFile <- if (is.null(file))
> 	tempfile("RpackageInfo")
>     else
> 	file
>     outConn <- file(outFile, open = "w")
>     vignetteMsg <- paste("Further information is available in the following ", 
>         "vignettes in directory ", sQuote(file.path(x$path, "doc")), 
>         ":", sep = "")
>     headers <- c("", "Description:\n\n", "Index:\n\n", paste(paste(strwrap
> (vignetteMsg), 
>         collapse = "\n"), "\n\n", sep = ""))
>     footers <- c("\n", "\n", "\n", "")
>     formatDocEntry <- function(entry) {
>         if (is.list(entry) || is.matrix(entry)) 
>             formatDL(entry, style = "list")
>         else entry
>     }
>     for (i in which(!sapply(x$info, is.null))) {
>         writeLines(headers[i], outConn, sep = "")
>         writeLines(formatDocEntry(x$info[[i]]), outConn)
>         writeLines(footers[i], outConn, sep = "")
>     }
>     close(outConn)
>     if (is.null(file))
> 	    file.show(outFile, delete.file = TRUE, title = paste
> ("Documentation for package", 
> 		sQuote(x$name)))
>     invisible(x)
> }

> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


[Rd] directing print.packageInfo to a file
Kurt Hornik