| if_na | R Documentation | 
This is just shorthand for ifelse(is.na(x), TRUE, FALSE) because I like using
that pattern in my dplyr pipelines.
if_na(x, yes = TRUE, no = NULL)
x | 
 (Vector) A vector to test.  | 
yes | 
 (Any) The value to return if   | 
no | 
 (Any) The value to return if   | 
The object in yes or no, depending on the outcome.
Desi Quintans (http://www.desiquintans.com)
vec <- c("hello", NA, "hi")
if_na(vec, "REPLACED")
#> [1] "hello"    "REPLACED" "hi"
if_na(vec, "Was NA", "Was not NA")
#> [1] "Was not NA" "Was NA"     "Was not NA"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.