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

Z. Todd Taylor (Todd.Taylor@pnl.gov)
Thu, 04 Jun 1998 07:04:12 -0700


Date: Thu, 04 Jun 1998 07:04:12 -0700
From: Todd.Taylor@pnl.gov (Z. Todd Taylor)
Subject: Re: "as.numeric" / "As.numeric" [was "R-beta: bugs and problems"]
To: r-help@stat.math.ethz.ch

Ross Ihaka <ihaka@stat.auckland.ac.nz> 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?)

--Todd

(*) Broken As Designed In My Opinion

-- 
Z. Todd Taylor
Pacific Northwest National Laboratory
Todd.Taylor@pnl.gov
Why is it Filipino, not Philippino?
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._