mitchelloharawild / distributional

Vectorised distributions for R
https://pkg.mitchelloharawild.com/distributional
GNU General Public License v3.0
94 stars 15 forks source link

Transformed sample distributions don't strip the distribution wrapper class #81

Closed mitchelloharawild closed 1 year ago

mitchelloharawild commented 1 year ago

First reported here: https://github.com/tidyverts/fabletools/issues/365

Reprex:

library(distributional)
z <- dist_sample(list(rnorm(10)))
y <- z + 1 - 1
waldo::compare(z, y)
#> `class(old[[1]])`: "dist_sample"  "dist_default"       
#> `class(new[[1]])`: "distribution" "vctrs_vctr"   "list"
#> 
#> `names(old[[1]])` is a character vector ('x')
#> `names(new[[1]])` is absent
#> 
#> `old[[1]][[1]]` is a double vector (-0.150150416298483, 0.589858719451371, -1.30637657466461, -0.661723727293455, 1.54528081833613, ...)
#> `new[[1]][[1]]` is an S3 object of class <distribution/vctrs_vctr/list>, a list

Created on 2022-09-20 by the reprex package (v2.0.1)