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
Is there any way to have a tidy_draws dataframe work correctly with dimensions that have whitespace?
It seems like there could be some workaround using the "tidybayes_constructors" attribute like in recover_types, but that relies on knowing what the dimension will be called, which is not ideal.
Example of things not working as desired:
library(tidyverse)
library(tidybayes)
my_tidy_draws<-
expand_grid(.chain=1:4, .iteration=1:5) |>
mutate(.draw=tidybayes:::draw_from_chain_and_iteration_(.chain, .iteration)) |>
mutate(`x[group with a space]`= rnorm(n()),
`x[another group]`= rnorm(n())) |>
tidy_draws()
spread_draws(my_tidy_draws, x[a])
#> Warning: Expected 1 pieces. Additional pieces discarded in 2 rows [1, 2].#> # A tibble: 40 × 5#> # Groups: a [2]#> a x .chain .iteration .draw#> <chr> <dbl> <int> <int> <int>#> 1 another -2.41 1 1 1#> 2 another -1.16 1 2 2#> 3 another -1.85 1 3 3#> 4 another 0.156 1 4 4#> 5 another -1.50 1 5 5#> 6 another -0.286 2 1 6#> 7 another 0.487 2 2 7#> 8 another 0.169 2 3 8#> 9 another 0.582 2 4 9#> 10 another -1.10 2 5 10#> # ℹ 30 more rows
Is there any way to have a
tidy_draws
dataframe work correctly with dimensions that have whitespace?It seems like there could be some workaround using the
"tidybayes_constructors"
attribute like inrecover_types
, but that relies on knowing what the dimension will be called, which is not ideal.Example of things not working as desired:
Created on 2024-11-13 with reprex v2.1.1
The text was updated successfully, but these errors were encountered: