From roland.puntaier at chello.at  Mon Feb  9 18:13:29 2004
From: roland.puntaier at chello.at (roland.puntaier@chello.at)
Date: Mon Feb  9 18:13:50 2004
Subject: [Rd] apply on logical data frame together with all (PR#6560)
Message-ID: <20040209171329.5E7D0EB24@slim.kubism.ku.dk>

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)


[Rd] apply on logical data frame together with all (PR#6560)
roland.puntaier@chello.at