You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And the expected output type is not documented for these functions. I think it would be good to have consistent output type. For example, I was surprised that density(dist_norma(), 0) returns a scalar, but that density(dist_normal(), c(0,1)) returns a list, while with two distributions and single point we get a vector.
One possibility is to always return a list, where each element corresponds to one distribution, like it is now for some of the outputs. Although I believe this would be desirable, it is a breaking change that might affect other packages. In any case, the return value type should be documented.
Additionally, it could also be nice to have an option simplify2array as an argument.
The text was updated successfully, but these errors were encountered:
The documentation should definitely be improved to explain how the distributions and arguments are vectorised. Essentially the operation's argument (e.g. density(at=)) is vectorised across the distributions and the result is simplified if possible. While I agree that returning lists with one element is more consistent, it would be less efficient and less usable - it could be a non-default option, like drop = FALSE.
While doing some testing I noticed that density, cdf and quantile sometimes return vectors, sometimes lists:
Created on 2024-04-01 with reprex v2.1.0
And the expected output type is not documented for these functions. I think it would be good to have consistent output type. For example, I was surprised that
density(dist_norma(), 0)
returns a scalar, but thatdensity(dist_normal(), c(0,1))
returns a list, while with two distributions and single point we get a vector.One possibility is to always return a list, where each element corresponds to one distribution, like it is now for some of the outputs. Although I believe this would be desirable, it is a breaking change that might affect other packages. In any case, the return value type should be documented.
Additionally, it could also be nice to have an option simplify2array as an argument.
The text was updated successfully, but these errors were encountered: