Skip to content

Functional dependency rule does not fail for all invalid rows #201

@grimmjulian

Description

@grimmjulian

Hi, thanks for the great package! It really helps a lot.

I’ve encountered unexpected behavior when using checking for a functional dependency.

My expectation is that this rule should fail for every row with a value of a that has not a unique corresponding value in b. However, in practice, the rule only fails for all but the first offending row — it appears that only the first violation is ignored or not counted.

d <- data.frame(a = c(1, 1), b  = c(1, 2))
val <- validator(a ~ b)
out <- confront(d, val)
nrow(violating(d, out))
# 1

I would expect it to mark both rows as violating similar to is_unique:

d <- data.frame(a = c(1, 1), b  = c(1, 2))
val <- validator(is_unique(a))
out <- confront(d, val)
nrow(violating(d, out))
# 2

Is this a bug or the intended behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions