maybe_case | R Documentation |
Unwrap and call a function on a maybe value or return a default
maybe_case(.m, .f, default)
.m |
A maybe value |
.f |
A function to apply to the maybe value in the case of 'Just' |
default |
A default value to return in the case of 'Nothing' |
The return value of the 'Just' function or the default value
just(1:10) %>% maybe_case(mean, 0)
nothing() %>% maybe_case(mean, 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.