Skip to content

Commit

Permalink
Add support method for dist_sample
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Sep 17, 2024
1 parent ba8e22f commit 01716f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ S3method(density,dist_weibull)
S3method(density,dist_wrap)
S3method(density,distribution)
S3method(dim,dist_default)
S3method(dim,dist_mixture)
S3method(dim,dist_multinomial)
S3method(dim,dist_mvnorm)
S3method(dimnames,distribution)
Expand Down Expand Up @@ -444,6 +445,7 @@ S3method(sum,distribution)
S3method(support,dist_categorical)
S3method(support,dist_default)
S3method(support,dist_percentile)
S3method(support,dist_sample)
S3method(support,dist_transformed)
S3method(support,distribution)
S3method(variance,default)
Expand Down
9 changes: 8 additions & 1 deletion R/dist_sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ skewness.dist_sample <- function(x, ..., na.rm = FALSE) {
y * ((1 - 1/n))^(3/2)
}


#' @export
support.dist_sample <- function(x, ...) {
new_support_region(
list(vctrs::vec_init(x$x, n = 0L)),
list(range(x$x)),
list(rep(TRUE, 2))
)
}

#' @method Math dist_sample
#' @export
Expand Down

0 comments on commit 01716f7

Please sign in to comment.