Open n-kall opened 8 months ago
This suggests to me that the output is being bound into a matrix (which requires a single type) and then converted to a data frame later, which it should probably not be. Rather than potentially round-tripping through a string (with the possibility for information loss) I would suggest binding results together into a data frame directly, which should be more efficient anyway.
This suggests to me that the output is being bound into a matrix
Yes, this is indeed the case
I agree. that would make sense
n-kall @.***> schrieb am Do., 14. März 2024, 18:52:
This suggests to me that the output is being bound into a matrix
Yes, this is indeed the case
— Reply to this email directly, view it on GitHub https://github.com/stan-dev/posterior/issues/355#issuecomment-1997904615, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCW2ACGQU7UVGXE5IGYAHDYYHIVHAVCNFSM6AAAAABEVXULC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJXHEYDINRRGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>
It seems this is also caused by the behaviour of unlist
, which results in a vector, and when performed on a list with different types inside, will convert them all to the same (in this case character). This unlisting is done to handle summary functions that return multiple elements (e.g. quantile2
).
However, I don't know of a base R equivalent to purrr::flatten
which would do what we want in this case (returning a list, but without nesting).
If a summary function that returns a character is used in
summarise_draws
, it makes all columns<chr>
which messes up formatting.Returns
This could be fixed by using
type.convert(out, as.is = TRUE)
on the output tibble insummarise_draws_helper