From Martin Maechler <maechler@stat.math.ethz.ch>  Thu Sep  7 09:17:48 2000
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Thu, 7 Sep 2000 10:17:48 +0200 (CEST)
Subject: [Rd] asmode.integer()  -- RFC
Message-ID: <14775.20268.82086.175632@gargle.gargle.HOWL>

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
define 

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


[Rd] asmode.integer() -- RFC
Martin Maechler