Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement "assert_rows" #10

Closed
tonyfischetti opened this issue May 14, 2015 · 0 comments
Closed

Implement "assert_rows" #10

tonyfischetti opened this issue May 14, 2015 · 0 comments

Comments

@tonyfischetti
Copy link
Owner

assert_rows :: data.frame df => df -> (df -> [a]) -> (a -> Bool) -> df

assert_rows(a, b, c, ...)
a = data frame
b = function that takes data frame and returns nrow vector
c = predicate
... optional "select" rows

map the predicate c over return value from b(a)
[map(c), b(a))]

example:

iris %>%
   assert_rows(cosine_dist, within_bounds(0,.5), -Species) %>%
    ...

the error message will read like....
Error: Assertion 'within_bounds' violated at row 4 of iris (value: 32.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant