[Rd] matrix coercion, logical -> character

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Dec 8 17:00:13 MET 2003


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 at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-devel mailing list