[Rd] asmode.integer() -- RFC

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Thu, 7 Sep 2000 10:17:48 +0200 (CEST)

Many of us known that sometimes, e.g. in calls to .C(..), you want to
basically say
	  x <- as.integer(x)

but you can't do that because as.vector() 
and it's descendants such as as.integer, as.double, as.character
drop all attributes.

Several months ago, someone proposed to use a new function
As.integer() instead.  
Since I just now again "stumbled" on it, I wondered if it might be worth to

      asmode.integer   <- function(x) { mode(x) <- "integer"   ; x }
      asmode.double    <- function(x) { mode(x) <- "double"    ; x }
      asmode.character <- function(x) { mode(x) <- "character" ; x }

in order to encourage more shorter & more readable code...
or would you hate to see yet more functions doing `almost the same' as
others do?

[RFC = Request for comments]

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
r-devel 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-devel-request@stat.math.ethz.ch