Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.BSF.4.05.9904162055440.9254-100000@g.ihaka.slip.auckland.ac.nz>
Date: 1999-04-16T09:02:06Z
From: Ross Ihaka
Subject: stamp function in R
In-Reply-To: <FADDNHDOIPPAAAAA@hotbot.com>

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