Description Usage Arguments Value Examples
Check that a condition holds on the columns of data between pipe stages.
1 2 |
.data |
Incoming data (omitted if in pipe). |
cond |
Column-wise condition expression to test. |
msg |
User message to display if test fails. |
active |
Is this check turned on (default TRUE). Set FALSE to disable test (e.g., in production). |
logger |
Function to call with message (e.g., 'warning' or 'stop'). |
Input data without modification.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
data %>% mutate(...) %>%
# Always check that age is greater than or equal to 18.
nickr_col(age >= 18) %>%
# Only check that age lies below maximum when not in production.
nickr_col(age <= max_age, active = !IN.PRODUCTION) %>%
# Generate a warning if person_id doesn't match the expected pattern.
nickr_col(str_detect(person_id, "[A-Z][A-Z]"),
msg = "Person ID must be 2 letters", logger = warning) %>%
# Further processing on unmodified data.
filter(...)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.