I am trying to understand the operator |in R. Why
|
a = 2 a == 3 | 4
return TRUEin R?
TRUE
a == 3
and
a == 4
each returns FALSE, so why does the second row return TRUE?
FALSE
See help(Syntax)- ==has a higher priority than |.
help(Syntax)
==
So:
R> a <- 2 R> a == 3 | 4 R> TRUE R> a == (3 | 4) R> FALSE
a == 3 | 4
Facilities:
Is (equal to 3) or (4)?
Coincidentally, 4 evaluates to TRUE when forced to boolean.
:
`|`(a == 3, 4) `==`(a, 3) as.logical(2) # TRUE as.logical(3) # TRUE as.logical(4) # TRUE
, , a == 3 ; TRUE == TRUE, TRUE. or TRUE 4 TRUE.
TRUE == TRUE
or
4
Source: https://habr.com/ru/post/1544944/More articles:Matlab ограничивает TBB, но не OpenMP - matlabCannot insert null value in column, table; column does not allow zeros. INSERT not working - c #Sending http headers in CasperJS presentation form - javascriptКак синхронный вызов дочернего процесса в CasperJS? - javascriptUnable to see minus Terminator NULL - nullHTTP: can I trust the value of the Content-Length request header? - httpincluding ldap granule plugin - grailsDisplay raw data from image file using TextBox or RichTextBox? - c #Convert Text Email to Interactive Link - REGEX / jQuery - regexIntermittent Error kCFStreamErrorDomainSSL 9813 - iosAll Articles