Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-22 Thread William Michels via R-help
Evaluation of the NOT, AND, OR logical statements below in MySQL 5.5.30-log Community Server (GPL) replicate R's truth tables for NOT, AND, OR. See MySQL queries (below), which are in agreement with R truth table code posted in this thread: bash-3.2$ mysql Welcome to the MySQL monitor. Commands

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-21 Thread William Michels via R-help
Looking below and online, R's truth tables for NOT, AND, OR are identical to the NOT, AND, OR truth tables originating from Stephen Cole Kleene's "strong logic of indeterminacy", as demonstrated on the Wikipedia page entitled, "Three-Valued Logic"--specifically in the section entitled "Kleene and

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-21 Thread Hadley Wickham
On Fri, May 19, 2017 at 6:38 AM, S Ellison wrote: >> 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. >> >> As I said *think* about it; don't

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-20 Thread Duncan Murdoch
On 20/05/2017 5:53 AM, Martin Maechler wrote: Ramnik Bansal on Sat, 20 May 2017 08:52:55 +0530 writes: > Taking this question further. > If I use a complex number or a numeric as an operand in logical > operations, to me it APPEARS that these two types

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-20 Thread Martin Maechler
> Ramnik Bansal > on Sat, 20 May 2017 08:52:55 +0530 writes: > Taking this question further. > If I use a complex number or a numeric as an operand in logical > operations, to me it APPEARS that these two types are first coerced to > LOGICAL

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Ramnik Bansal
Taking this question further. If I use a complex number or a numeric as an operand in logical operations, to me it APPEARS that these two types are first coerced to LOGICAL internally and then THIS logical output is further used as the operand. For eg. > x <- 4+5i; c(x & F, x & T, x | F, x | T)

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Ted Harding
[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

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Jeff Newmiller
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" wrote: >My apologies if

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Duncan Murdoch
On 19/05/2017 8:48 AM, S Ellison wrote: SQL, for example, generally takes the view that any expression involving 'missing' is 'missing'. Well, then SQL gets it wrong. Well, that's a view. But paraphrasing an R Turner from a few lines away in the same email: One should be very, very

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread peter dalgaard
> On 19 May 2017, at 14:24 , 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? > At the risk of

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread S Ellison
> > SQL, for example, generally takes the view that any > > expression involving 'missing' is 'missing'. > > Well, then SQL gets it wrong. Well, that's a view. But paraphrasing an R Turner from a few lines away in the same email: > One should be very, very circumspect about presuming to know

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Jérémie Juste
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 wrote: > On 20/05/17 00:01,

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Rolf Turner
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

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Rolf Turner
On 19/05/17 23:38, S Ellison wrote: 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. As I said *think* about it; don't just go with your immediate knee-jerk (simplistic)

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Jérémie Juste
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 ? Best regards, Jeremie On Fri, May 19, 2017

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread S Ellison
> 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. > > As I said *think* about it; don't just go with your immediate knee-jerk > (simplistic) reaction. Hmm... not sure

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread Rolf Turner
On 19/05/17 21:48, Ramnik Bansal wrote: Hi, I need to understand the inconsistent behaviour of & and I operators when used with NA. The code below explains this inconsistency TRUE & NA [1] NA FALSE & NA [1] FALSE TRUE & NA [1] NA FALSE | NA [1] NA TRUE | NA [1] TRUE TRUE ==