Skip to content
Prev 2414 / 398506 Next

stamp function in R

On Fri, 16 Apr 1999, Ananke wrote:

            
Well, shooting from the hip ... Something like the following ought to do
the trick.
 
"stamp" <-
function (string = date(), print = TRUE, plot = TRUE) 
{
    if (print) 
        cat(string)
    if (plot && .Device != "null device") {
        mar <- par("mar")[[1]]
        usr <- par("usr")
        plt <- par("plt")
        at <- usr[2] + (usr[2] - usr[1]) * (1 - plt[2]) / (plt[2] - plt[1])
        mtext(string, side = 1, adj = 1, line = mar - 1, at = at)
    }
}

It doesn't place the label in the plot identically, but this is the
spirit of the function.

[ This has also revealed a bug in the "date" function.  It leaves a
newline appended to the date string. ]

	Ross

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._