Skip to content

Commit

Permalink
Minor fix to dist_sample methods dimensions for multivariate dist
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Sep 15, 2024
1 parent 78ee386 commit 7c3d0eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ S3method(format,dist_f)
S3method(format,dist_gamma)
S3method(format,dist_geometric)
S3method(format,dist_gev)
S3method(format,dist_gpd)
S3method(format,dist_gh)
S3method(format,dist_gk)
S3method(format,dist_gpd)
S3method(format,dist_gumbel)
S3method(format,dist_hypergeometric)
S3method(format,dist_inflated)
Expand Down Expand Up @@ -486,9 +486,9 @@ export(dist_f)
export(dist_gamma)
export(dist_geometric)
export(dist_gev)
export(dist_gpd)
export(dist_gh)
export(dist_gk)
export(dist_gpd)
export(dist_gumbel)
export(dist_hypergeometric)
export(dist_inflated)
Expand Down
4 changes: 2 additions & 2 deletions R/dist_sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ quantile.dist_sample <- function(x, p, type = "marginal", ..., na.rm = TRUE){
if(is.matrix(x$x)) {
# Marginal quantiles
return(
matrix(apply(x$x, 2, quantile, p = p, ..., na.rm = na.rm), nrow = 1)
matrix(apply(x$x, 2, quantile, p = p, ..., na.rm = na.rm), nrow = length(p))
)
}
quantile(x$x, probs = p, ..., na.rm = na.rm, names = FALSE)
Expand Down Expand Up @@ -106,7 +106,7 @@ mean.dist_sample <- function(x, ...){
#' @export
median.dist_sample <- function(x, na.rm = FALSE, ...){
if(is.matrix(x$x))
apply(x$x, 2, median, na.rm = na.rm, ...)
matrix(apply(x$x, 2, median, na.rm = na.rm, ...), nrow = 1L)
else
median(x$x, na.rm = na.rm, ...)
}
Expand Down
1 change: 1 addition & 0 deletions man/dist_multivariate_normal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7c3d0eb

Please sign in to comment.