Skip to content

Instantly share code, notes, and snippets.

@daranzolin
Created December 15, 2018 01:09
Show Gist options
  • Select an option

  • Save daranzolin/7eff7cbeb87f9d0ffd9b8fc04f194207 to your computer and use it in GitHub Desktop.

Select an option

Save daranzolin/7eff7cbeb87f9d0ffd9b8fc04f194207 to your computer and use it in GitHub Desktop.
mutate test
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