tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

How to unnest column .distribution. - class fcdist ? #261

Closed lsempe77 closed 4 years ago

lsempe77 commented 4 years ago

I would like to extract the SD

When I try data %>% unnest(x)

Prints error: Error: Input must be list of vectors

Or data %>% unpack(.,cols=c(x))

it prints: Error: Can't convert <distribution> to <integer>.

In the past I used: data %>% unnest_wider(.,cols=c(x)) , but it doesn't work either (Error: Input must be list of vectors)

Thanks!

mitchelloharawild commented 4 years ago

The fcdist class has been replaced by the distributional package - https://github.com/mitchelloharawild/distributional/. You can extract the mean and variance of a distribution using mean() and variance(). This should be sufficient for parameterising most distributions.

There is an open issue here for creating a better method of extracting distribution parameters.

lsempe77 commented 4 years ago

Thanks! distributional::variance(data$x) worked well!