Re: "as.numeric" / "As.numeric" [was "R-beta: bugs and problems"]

Z. Todd Taylor (
Thu, 04 Jun 1998 07:04:12 -0700

Date: Thu, 04 Jun 1998 07:04:12 -0700
From: (Z. Todd Taylor)
Subject: Re: "as.numeric" / "As.numeric" [was "R-beta: bugs and problems"]

Ross Ihaka <> wrote:

> Martin Maechler writes:

[ snip ]

>  > I've seen
>  > 	As.numeric <- function(x) { storage.mode(x) <- "numeric"; x }
>  > solving the above problem.
>  > 
>  > What do you (R-help readers !) think?
> I like the idea, but maybe not the name so much (too much scope for
> confusion).  Could I make a plug for something like "mode.numeric" or
> "as.numeric.mode".
> A single function of the form
> 	ensure.mode(x, "double")
> would be another approach.

Maybe it's a little obscure, but for a decade we've been using
the convention of capitalizing a function name to indicate it
as a local "replacement" for a BADIMO(*) S built-in.

e.g.:  Mean - just like 'mean' but na.rm defaults to T (Ditto for
          Min, Median, Sum, Any, Cor, Range, etc.)
       Diff, Lag - return answers exactly parallel to their inputs
       Window - returns a ts exactly the size you asked for without
          lopping off the end(s)
       Brush - eliminates NAs, takes data frames, doesn't crash
          on two-column input
       Interp - eliminates duplicate tuples, accepts NAs
       Scan, Read.Table - accept "filenames" that represent Unix
          pipes.  e.g., Scan(file = "grep 'keep' myfile |", ...)

(Doesn't anyone else do this?)


(*) Broken As Designed In My Opinion

Z. Todd Taylor
Pacific Northwest National Laboratory
Why is it Filipino, not Philippino?
r-help mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: