[R] stamp function in R

Ross Ihaka ihaka at stat.auckland.ac.nz
Fri Apr 16 11:02:06 CEST 1999



On Fri, 16 Apr 1999, Ananke wrote:

> Dear R experts,
> 
> currently I'm converting a bit of trivial
> Splus code to R.
> In Splus I came across the stamp function.
> Does R have something similar?

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list