rstanarm::posterior_predict() creates objects of class "ppd" "matrix" "array" . I want to convert such objects to clean tibbles. I tried:
library(tidyverse)
library(rstanarm)
#> Loading required package: Rcpp
#> This is rstanarm version 2.21.1
#> - See https://mc-stan.org/rstanarm/articles/priors for changes to default priors!
#> - Default priors may change, so it's safest to specify priors, even if equivalent to the defaults.
#> - For execution on a local, multicore CPU with excess RAM we recommend calling
#> options(mc.cores = parallel::detectCores())
obj <- stan_glm(data = women, height ~ 1, refresh = 0)
pp <- posterior_predict(obj)
pp %>%
as_tibble()
#> # A tibble: 4,000 x 15
#> `1` `2` `3` `4` `5` `6` `7` `8` `9` `10` `11` `12` `13`
#> <ppd> <ppd> <ppd> <ppd> <ppd> <ppd> <ppd> <ppd> <ppd> <ppd> <ppd> <ppd> <ppd>
#> 1 66.4… 61.5… 67.9… 59.4… 64.8… 60.4… 60.5… 63.9… 67.1… 66.1… 66.6… 65.7… 67.0…
#> 2 70.3… 60.0… 57.9… 58.2… 67.6… 63.1… 52.7… 62.5… 67.3… 51.3… 59.9… 63.7… 56.9…
#> 3 65.4… 65.1… 59.6… 69.3… 73.6… 63.8… 69.2… 72.8… 71.9… 61.6… 73.8… 64.0… 68.1…
#> 4 67.3… 63.7… 67.9… 66.5… 60.1… 63.1… 61.1… 71.1… 71.9… 63.7… 64.2… 61.4… 70.9…
#> 5 66.3… 62.2… 61.1… 66.5… 63.3… 68.3… 61.2… 59.3… 63.4… 69.5… 65.3… 61.0… 67.4…
#> 6 77.7… 55.4… 64.5… 67.2… 72.8… 55.1… 60.2… 67.3… 53.8… 59.5… 67.8… 65.6… 53.0…
#> 7 67.4… 68.8… 68.3… 70.9… 67.4… 65.4… 66.5… 64.7… 65.1… 69.9… 60.5… 68.3… 60.9…
#> 8 63.6… 81.7… 73.0… 61.7… 69.3… 69.9… 68.7… 69.4… 64.8… 62.0… 61.5… 65.3… 65.0…
#> 9 58.8… 63.4… 64.5… 67.5… 64.9… 60.1… 66.8… 65.6… 62.5… 63.8… 65.4… 58.5… 63.0…
#> 10 62.5… 60.3… 70.7… 72.0… 72.2… 76.3… 71.4… 65.9… 66.6… 72.3… 67.4… 64.1… 68.5…
#> # … with 3,990 more rows, and 2 more variables: `14` <ppd>, `15` <ppd>
Created on 2020-10-14 by the reprex package (v0.3.0)
I would like each column to be a double, as we would get if pp were a simple matrix. But, as you can see, each column is, itself, an object of class ppd. How can I convert an object of class "ppd" "matrix" "array" to a clean tibble?