Z. Todd Taylor
1998-Jun-04 14:04 UTC
"as.numeric" / "As.numeric" [was "R-beta: bugs and problems"]
Ross Ihaka <ihaka at 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 at 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 at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Apparently Analagous Threads
- R-beta: Re: S Compatibility
- R-beta: Re: "as.numeric" `mode' and `cast' should be kept separate.
- followup: lookup function for density(...) objects
- Funding freeeware (was: R-beta: help in sept) (fwd)
- lm-residuals and NA {was Can't understand error message :-{}