slice_left | R Documentation |
slice_left()
removes probability to the left of some breakpoint,
conditioning the random variable to be bigger than the breakpoint.
slice_right()
does the opposite: removes probability to the right,
conditioning to be smaller than the breakpoint.
slice_left(distribution, breakpoint, include = TRUE, ...)
slice_right(distribution, breakpoint, include = TRUE, ...)
distribution |
Distribution to slice. |
breakpoint |
Point at which to slice (single numeric). |
include |
Logical; should the breakpoint be removed as well? This is only realistically relevant if the breakpoint has a non-zero probability of occurrence. |
... |
Other arguments to pass to specific methods. Currently unused. |
A conditional distribution.
library(magrittr)
distionary::dst_norm(0, 1) %>%
slice_left(-2) %>%
slice_right(2) %>%
distionary::enframe_cdf(at = -3:3)
d <- distionary::dst_empirical(c(2, 5, 6, 9, 11))
d %>%
slice_left(5) %>%
distionary::eval_pmf(at = 5)
d %>%
slice_left(5, include = TRUE) %>%
distionary::eval_pmf(at = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.