Skip to content

Commit

Permalink
Fix generate() for univariate but named distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Sep 17, 2024
1 parent e9d7e99 commit a03d156
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,14 @@ generate.distribution <- function(x, times, ...){
x <- vec_data(x)
dist_is_na <- vapply(x, is.null, logical(1L))
x[dist_is_na] <- list(structure(list(), class = c("dist_na", "dist_default")))
mapply(function(x, ...) `colnames<-`(generate(x, ...), dn),
x, times = times, ..., SIMPLIFY = FALSE)
mapply(
function(x, ...) {
y <- generate(x, ...)
if (is.matrix(y)) colnames(y) <- dn
y
}, x, times = times, ...,
SIMPLIFY = FALSE
)
# dist_apply(x, generate, times = times, ...)
# Needs work to structure MV appropriately.
}
Expand Down

0 comments on commit a03d156

Please sign in to comment.