randrescastaneda / joyn

joyn provides a set of tools to analyze the quality of merging (i.e., joining) data frames. It is a JOY to join with joyn
https://randrescastaneda.github.io/joyn/
Other
7 stars 2 forks source link

Is balanced #33

Closed zander-prinsloo closed 8 months ago

zander-prinsloo commented 8 months ago

Create is_balanced function and documentation. There are no tests yet.

Please check whether it makes sense and whether it does what you intend it to.

The example that I used in documentation are also given below:

x1 = data.frame(id = c(1L, 1L, 2L, 3L, NA_integer_),
                t  = c(1L, 2L, 1L, 2L, NA_integer_),
                x  = 11:15)
is_balanced(df = x1,
            by = c("id", "t"),
            return = "table") # returns combo of "id" and "t" not in df
#>   id t
#> 1  3 1
#> 2  2 2
is_balanced(df = x1,
            by = c("id", "t"),
            return = "logic") # returns TRUE or FALSE
#> [1] FALSE