Something bizarre happens when you try to graft both tails, one following the other. Here's a reprex to debug, although it requires adding a line -- print(breakpoint) -- at the top of one of the default slice methods. In this case, I've added it to slice_right.dst().
library(distplyr)
#> ℹ Loading distplyr
d <- dst_norm(0, 1)
dl <- d %>% graft_left(d, breakpoint = -1)
#> [1] -1
dlr <- dl %>% graft_right(d, breakpoint = 1)
#> [1] -1
plot(dlr, "cdf", from = -3, to = 3)
The issue is pinpointed in the two lines with invisible: calling the method directly yields the appropriate breakpoint value, whereas going through the generic yields the breakpoint from the previous graft. Somehow, the scoping rules are favouring the breakpoint entry that's being stored in the dl graft distribution (see the output of the last line), as opposed to the one directly input as a function argument.
Something bizarre happens when you try to graft both tails, one following the other. Here's a reprex to debug, although it requires adding a line --
print(breakpoint)
-- at the top of one of the default slice methods. In this case, I've added it toslice_right.dst()
.Created on 2021-08-30 by the reprex package (v0.3.0)
The issue is pinpointed in the two lines with
invisible
: calling the method directly yields the appropriate breakpoint value, whereas going through the generic yields the breakpoint from the previous graft. Somehow, the scoping rules are favouring thebreakpoint
entry that's being stored in thedl
graft distribution (see the output of the last line), as opposed to the one directly input as a function argument.