maybe_do | R Documentation |
will apply func to x if bool is TRUE. Saves us from an ugly function
maybe_do(x, bool, func, ...)
x |
anything really , just the first argument of func |
bool |
Boolean. applies function if bool is True |
func |
function that takes x and ... |
... |
passed to func |
maybe_do(c(2, 2,100), TRUE, function(x){x*2}) maybe_do(c(2, 2,100), FALSE, function(x){x*2})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.