3 回答
TA贡献1811条经验 获得超6个赞
((-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贡献1804条经验 获得超3个赞
&&
||
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 关注
- 634 浏览
添加回答
举报