Subtracts from each part all the parts before it, so the result covers the same set with parts meeting only on boundaries, and a measure can be summed over them without double-counting. Parts meeting only in a lower-dimensional slice are left overlapping (see region_algebra).
Arguments
- x
A region.
- ...
For a union_region,
max_cells: the cap on the number of cells each difference may decompose into before giving up. Defaults to theripr.max_cellsoption, or1000Lwhen that is unset.
Value
A region covering the same set, whose parts have disjoint
interiors, or an empty_region() if x is empty.
Examples
# The two cells of the K = 3 plurality null overlap where candidate 1 trails
# both others. Peeling them apart leaves that region in one of the two.
plurality <-
simplex_region(vertices = rbind(c(0.5, 0.5, 0), c(0, 1, 0), c(0, 0, 1))) |
simplex_region(vertices = rbind(c(0.5, 0, 0.5), c(0, 1, 0), c(0, 0, 1)))
peeled <- disjoin(plurality)
length(parts(peeled))
#> [1] 2
peeled == plurality
#> [1] TRUE