[EMAIL PROTECTED] writes: > Full_Name: Roland Puntaier > Version: 1.8.1 > OS: Windows XP > Submission from: (NULL) (62.99.238.78) > > > I have a data frame with some columns being logical. > I wanted to calculate a column that is an AND combination of the other logical > columns. > I tried to use > apply(df,1,all) > It did not work because of the implicit string conversion. > So I made the functions > All<-function(...) all(as.logical(...))#because all cannot be used with apply > Any<-function(...) any(as.logical(...))#because any cannot be used with apply > Now > apply(df,1,All) > seemed to work, > but produced some NAs where there was no reason for them. > I debugged apply and found that some logical values are transformed to " TRUE" > instead of "TRUE". I did not follow that up closer. Instead I worked around it > by doing the string conversion myself and then call apply(dfc,1,All)
It's as documented (i.e. no bug) and the five-letter field for TRUE is consequence of using format(). Behaviour has been changed in r-devel though, since you weren't the first to be annoyed by it.... Meanwhile, I believe that do.call("cbind",df) is a better workaround. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel