Description Usage Arguments Examples
Friendlier messaging functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | stop_if(.x, .p = isTRUE, msg = NULL)
stop_if_any(.l, .p = isTRUE, msg = NULL)
stop_if_all(.l, .p = isTRUE, msg = NULL)
stop_if_none(.l, .p = isTRUE, msg = NULL)
stop_if_not(.x, .p = isTRUE, msg = NULL)
warn_if(.x, .p = isTRUE, msg = NULL)
warn_if_any(.l, .p = isTRUE, msg = NULL)
warn_if_all(.l, .p = isTRUE, msg = NULL)
warn_if_none(.l, .p = isTRUE, msg = NULL)
warn_if_not(.x, .p = isTRUE, msg = NULL)
message_if(.x = NULL, .p = isTRUE, msg = NULL)
message_if_any(.l, .p = isTRUE, msg = NULL)
message_if_all(.l, .p = isTRUE, msg = NULL)
message_if_none(.l, .p = isTRUE, msg = NULL)
message_if_not(.x, .p = isTRUE, msg = NULL)
|
.x |
the element to evaluate. It can be a predicate function (i.e a function returning TRUE). |
.p |
the predicate with the condition to test on |
msg |
the message to return. If NULL (default), the built-in message is printed. |
.l |
the list of elements to evaluate |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
x <- 12
stop_if(x, ~ .x > 13)
stop_if_not(x, is.character)
a <- "this is not numeric"
warn_if(a, is.character )
warn_if_not(a, is.numeric )
b <- 20
warn_if(b , ~ . > 10 ,
msg = "Wow, that's a lot of b")
c <- "a"
message_if(c, is.character,
msg = "You entered a character element")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.