-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
网友评论