3 回答

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超6個(gè)贊
((-2:2) >= 0) & ((-2:2) <= 0)# [1] FALSE FALSE TRUE FALSE FALSE
((-2:2) >= 0) && ((-2:2) <= 0)# [1] FALSE
all
any
if
.
all
any
ifelse
.
&&
||
a
&
|
a# Error: object 'a' not foundTRUE || a# [1] TRUEFALSE && a# [1] FALSETRUE | a# Error: object 'a' not foundFALSE & a# Error: object 'a' not found

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超3個(gè)贊
&&
||
if (cond) {} else{}
&
|
&&
||
> if( print(1) ) {print(2)} else {print(3)}
[1] 1
[1] 2
> if(FALSE && print(1) ) {print(2)} else {print(3)} # `print(1)` not evaluated
[1] 3
> if(TRUE && print(1) ) {print(2)} else {print(3)}
[1] 1
[1] 2
> if(TRUE && !print(1) ) {print(2)} else {print(3)}
[1] 1
[1] 3
> if(FALSE && !print(1) ) {print(2)} else {print(3)}
[1] 3
- 3 回答
- 0 關(guān)注
- 663 瀏覽
添加回答
舉報(bào)