Skip to content
Back to formatted view

Raw Message

Message-ID: <x2smjvpaeq.fsf@biostat.ku.dk>
Date: 2003-12-08T16:59:14Z
From: Peter Dalgaard
Subject: matrix coercion, logical -> character

Anyone know whether this is intentional, and by which rationale?
(R-devel on RedHat, but hardly new)


> l <- data.frame(a=rpois(10,1)>0,b=rpois(10,1)>0)
> apply(l,1,which)
Error in FUN(newX[, i], ...) : argument to "which" is not logical
> lapply(l,mode)
$a
[1] "logical"

$b
[1] "logical"

> mode(as.matrix(l))
[1] "character"


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