On 20/05/17 00:01, J?r?mie Juste wrote:> Hello, > > Rolf said, > > TRUE & FALSE is FALSE but TRUE & TRUE is TRUE, so TRUE & NA could be > either TRUE or FALSE and consequently is NA. > > OTOH FALSE & (anything) is FALSE so FALSE & NA is FALSE. > > > According to this logic why is > > FALSE & NA > > [1] FALSEHuh???? cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276
My apologies if I was not clear enough, TRUE & NA could be either TRUE or FALSE and consequently is NA. why is FALSE & NA = FALSE? NA could be TRUE or FALSE, so FALSE & NA should be NA? On Fri, May 19, 2017 at 2:13 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:> On 20/05/17 00:01, J?r?mie Juste wrote: > >> Hello, >> >> Rolf said, >> >> TRUE & FALSE is FALSE but TRUE & TRUE is TRUE, so TRUE & NA could be >> either TRUE or FALSE and consequently is NA. >> >> OTOH FALSE & (anything) is FALSE so FALSE & NA is FALSE. >> >> >> According to this logic why is >> >> FALSE & NA >> >> [1] FALSE >> > > Huh???? > > > cheers, > > Rolf Turner > > -- > Technical Editor ANZJS > Department of Statistics > University of Auckland > Phone: +64-9-373-7599 ext. 88276 >-- J?r?mie Juste [[alternative HTML version deleted]]
peter dalgaard
2017-May-19 13:00 UTC
[R] [FORGED] Logical Operators' inconsistent Behavior
> On 19 May 2017, at 14:24 , J?r?mie Juste <jeremiejuste at gmail.com> wrote: > > My apologies if I was not clear enough, > > TRUE & NA could be either TRUE or FALSE and consequently is NA. > why is FALSE & NA = FALSE? NA could be TRUE or FALSE, so FALSE & NA > should be NA? >At the risk of flogging a dead horse: FALSE & TRUE = FALSE FALSE & FALSE = FALSE FALSE & x = FALSE, whatever the value of x, hence FALSE & NA = FALSE Get it? -pd> > On Fri, May 19, 2017 at 2:13 PM, Rolf Turner <r.turner at auckland.ac.nz> > wrote: > >> On 20/05/17 00:01, J?r?mie Juste wrote: >> >>> Hello, >>> >>> Rolf said, >>> >>> TRUE & FALSE is FALSE but TRUE & TRUE is TRUE, so TRUE & NA could be >>> either TRUE or FALSE and consequently is NA. >>> >>> OTOH FALSE & (anything) is FALSE so FALSE & NA is FALSE. >>> >>> >>> According to this logic why is >>> >>> FALSE & NA >>> >>> [1] FALSE >>> >> >> Huh???? >> >> >> cheers, >> >> Rolf Turner >> >> -- >> Technical Editor ANZJS >> Department of Statistics >> University of Auckland >> Phone: +64-9-373-7599 ext. 88276 >> > > > > -- > J?r?mie Juste > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Jeff Newmiller
2017-May-19 13:06 UTC
[R] [FORGED] Logical Operators' inconsistent Behavior
FALSE & FALSE -> FALSE FALSE & TRUE -> FALSE Why do you need to know what the second value is? It doesn't matter what it is... the answer is FALSE. -- Sent from my phone. Please excuse my brevity. On May 19, 2017 5:24:06 AM PDT, "J?r?mie Juste" <jeremiejuste at gmail.com> wrote:>My apologies if I was not clear enough, > >TRUE & NA could be either TRUE or FALSE and consequently is NA. >why is FALSE & NA = FALSE? NA could be TRUE or FALSE, so FALSE & NA >should be NA? > > >On Fri, May 19, 2017 at 2:13 PM, Rolf Turner <r.turner at auckland.ac.nz> >wrote: > >> On 20/05/17 00:01, J?r?mie Juste wrote: >> >>> Hello, >>> >>> Rolf said, >>> >>> TRUE & FALSE is FALSE but TRUE & TRUE is TRUE, so TRUE & NA could be >>> either TRUE or FALSE and consequently is NA. >>> >>> OTOH FALSE & (anything) is FALSE so FALSE & NA is FALSE. >>> >>> >>> According to this logic why is >>> >>> FALSE & NA >>> >>> [1] FALSE >>> >> >> Huh???? >> >> >> cheers, >> >> Rolf Turner >> >> -- >> Technical Editor ANZJS >> Department of Statistics >> University of Auckland >> Phone: +64-9-373-7599 ext. 88276 >> > > > >-- >J?r?mie Juste > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
[I unadvertently sent my reply below to Jeremie, instead of R-help. Also, I havve had an additional thought which may clarify things for R users]. [Original reply]: The point about this is that (as Rolf wrote) FALSE & (anything) is FALSE, provided logical NA is either TRUE ot FALSE but, because the "NA" says that it is not known which it is, it could be "anything". And, indeed, if "NA" is given the "missing" meaning and if we assume that a missing logical value did indeed have a value (necessarily either TRUE or FALSE), then it follows logically that FALSE & NA = FALS?. On the other hand, if with the "missing" interpretation of "NA" we don't even know that it is a logical, then it might be fair enough to say FALSE & NA = NA. Ted. [Additional thought]: Testing to see what would happen if the NA were not loigical, I put myself (not being logical ... ) on the line, facing up to R: X <- "Ted" FALSE & X Error in FALSE & X : operations are possible only for numeric, logical or complex types So R will refuse to deal with any variable which cannot partake in a logical expression. Ted. On Fri, 2017-05-19 at 14:24 +0200, J?r?mie Juste wrote:> My apologies if I was not clear enough, > > TRUE & NA could be either TRUE or FALSE and consequently is NA. > why is FALSE & NA = FALSE? NA could be TRUE or FALSE, so FALSE & NA > should be NA? > > > On Fri, May 19, 2017 at 2:13 PM, Rolf Turner <r.turner at auckland.ac.nz> > wrote: > > > On 20/05/17 00:01, J?r?mie Juste wrote: > > > >> Hello, > >> > >> Rolf said, > >> > >> TRUE & FALSE is FALSE but TRUE & TRUE is TRUE, so TRUE & NA could be > >> either TRUE or FALSE and consequently is NA. > >> > >> OTOH FALSE & (anything) is FALSE so FALSE & NA is FALSE. > >> > >> > >> According to this logic why is > >> > >> FALSE & NA > >> > >> [1] FALSE > >> > > > > Huh???? > > > > > > cheers, > > > > Rolf Turner > > > > -- > > Technical Editor ANZJS > > Department of Statistics > > University of Auckland > > Phone: +64-9-373-7599 ext. 88276 > > > > > > -- > J?r?mie Juste > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.