Created
December 15, 2018 01:09
-
-
Save daranzolin/7eff7cbeb87f9d0ffd9b8fc04f194207 to your computer and use it in GitHub Desktop.
mutate test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(dplyr) | |
| library(assertr) | |
| set.seed(13) | |
| df <- data.frame(x = sample(0:1, 10,replace = TRUE), | |
| y = sample(0:1, 10, replace = TRUE)) | |
| df %>% | |
| rowwise() %>% | |
| mutate(total = sum(x:y)) %>% | |
| verify(total == 1) | |
| ### console output | |
| verification [total == 1] failed! (1 failure) | |
| verb redux_fn predicate column index value | |
| 1 verify NA total == 1 NA 6 NA | |
| Error: assertr stopped execution | |
| df | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment