Matrix intersections
Usage
matrix_intersect(x, y, false = "", fn = function(x, y) x == y)
matrix_anti_join(x, y, false = "", fn = function(x, y) x == y)
matrix_join(x, y, false = "", fn = function(z) z != false)
Examples
x <- matrix(sample(c('', '@'), 10, replace = TRUE), 2) |> print()
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] "" "" "" "@" ""
#> [2,] "" "" "" "" "@"
y <- matrix(sample(c('', '@'), 10, replace = TRUE), 2) |> print()
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] "@" "" "" "@" "@"
#> [2,] "@" "@" "" "" "@"
matrix_intersect(x, y)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] "" "" "" "@" ""
#> [2,] "" "" "" "" "@"
matrix_join(x, y)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] "@" "" "" "@" "@"
#> [2,] "@" "@" "" "" "@"
matrix_anti_join(x, y)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] "" "" "" "" ""
#> [2,] "" "" "" "" ""