| return_if_null | R Documentation |
If the focal input is NULL, return value from the parent function. Should only be used within a function.
return_if_null(x, value = NULL)
x |
Focal input. |
value |
If |
If x is not NULL, NULL is returned. If x is NULL, the result of return with value as its input evaluated within the parent function's environment is returned.
ff <- function(x = 1, null_return = "hello"){
return_if_null(x, null_return)
x
}
ff()
ff(NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.