From p.dalgaard@kubism.ku.dk  Tue Apr  8 23:16:43 1997
From: p.dalgaard@kubism.ku.dk (Peter Dalgaard BSA)
Date: 09 Apr 1997 00:16:43 +0200
Subject: R-alpha: as.numeric
In-Reply-To: Thomas Lumley's message of Tue, 8 Apr 1997 10:04:19 -0700 (PDT)
References: <Pine.SUN.3.91.970408100342.9023B-100000@chekov>
Message-ID: <x2iv1xtb1w.fsf@bush.kubism.ku.dk>

Thomas Lumley <thomas@biostat.washington.edu> writes:

> as.numeric() turns a logical matrix into a numeric vector. Shouldn't it 
> stay a matrix?

It *sounds* wrong, but:

S-PLUS : Copyright (c) 1988, 1996 MathSoft, Inc.
S : Copyright AT&T.
Version 3.4 Release 1 for Sun SPARC, SunOS 5.3 : 1996 
Working data will be in .Data 
> cbind(c(T,T),c(F,F))
     [,1] [,2] 
[1,]    T    F
[2,]    T    F
> as.numeric(.Last.value)
[1] 1 1 0 0

In fact, it does the same with numeric matrices.

To convert logical matrix to character matrix in Splus, you could
either add zero or use mode(x)<-"numeric", same thing in R.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: as.numeric
Peter Dalgaard BSA