20190427-R语言控制流函数ifelse

2019-04-27  本文已影响0人  天空的小白

-Usage
ifelse(test, yes, no)
当test只有两种情况时,可以使用ifelse,结果为TRUE时运行yes表示的命令,结果为FALSE时运行no表示的命令
-Arguments
test
an object which can be coerced to logical mode.
yes
return values for true elements of test.
no
return values for false elements of test.

-Details
If yes or no are too short, their elements are recycled. yes will be evaluated if and only
if any element of test is true, and analogously for no.
Missing values in test give missing values in the result.
-Example

ifelse
上一篇 下一篇

猜你喜欢

热点阅读