[R] Default value for title in postscript function
Uwe Ligges
ligges at statistik.uni-dortmund.de
Wed Apr 23 09:32:59 CEST 2003
Patrick Connolly wrote:
> I like the fact that the postscript function enables the possbiility
> of a more useful title than before. However, I'd prefer the default
> to be the file name.
>
> It's very simple for me to make my own postscript function that does
> just that simply by setting title = file. I always use onefile =
> TRUE, so it always works (so far). However, I'm a little reluctant to
> do that in case some future changes cause conflicts. I've been warned
> off tinkering with .Internal
>
> My question is: What is the tidiest way of doing such a thing? Should
> I make a private function that calls the standard postscript function,
> or should I go the whole hog and make an S4 type method to handle it?
A private function that calls postscript() seems to be a very clean
solution.
mypostscript <- function(file = ifelse(onefile, "Rplots.ps",
"Rplot%03d.ps"), onefile = TRUE, title = NULL, ...){
if(is.null(title)) title <- basename(file[1])
postscript(file = file, onefile = onefile, title = title, ...)
}
Uwe Ligges
> Or would it be simpler for the standard function to be changed
> (assuming, of course, there aren't good reasons against doing that)?
>
> best
>
More information about the R-help
mailing list