zifelse | R Documentation |
ifelse
statements with less typingUSE dplyr
's case_when
FOR ACTUAL WORKING CODE! This function is just code for my (Zach Burchill's) personal
reference in the future. I anticipate that the framework that I wrote here for might be useful for me in the future.
zifelse(...)
... |
Paired unnamed arguments, where the first in each pair is an expression that evaluates to a logical vector, and the second is the replacement value. The last argument needs to be a single, unpaired default replacement value. |
A vector of the same length as the logical vector that is the first argument
a <- runif(1000) zifelse(a >= 0 & a <= 0.33, 1, a > 0.33 & a <= 0.66, 2, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.