-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-standard use of non-standard evaluation #199
Comments
It took me a while to find about It feels like a tidyselect backend would make sense for selecting parameters. Combined with the suggestion above, we'd have fit %>%
spread_draws(
starts_with("sd_"),
indices = c(sd_alpha = "i", sd_beta = c("j", "k"))
) This would select all parameters starting with |
I like the idea of I see the potential value of a more tidyverse-style NSE in spread_draws/gather_draws, but there's a tension here in that there are two competing mental models I am trying to support with tidybayes: the tidyverse and probabilistic programming languages like Stan/JAGS/etc. I generally assume users have some mental model that includes each paradigm. I see spread_draws/gather_draws as the interface between those two worlds: I want everything else in the tidybayes API to follow the tidyverse model, but the little bit of code inside That said, I think adding alternate syntax to spread/gather_draws that uses tidyselect (maybe something like Re: variables versus indices, I could see changing the index syntax to use character vectors for index names to better match the distinction between existing variables / created ones. |
I think the intention makes sense. However, in a Stan model, the About Note that in principle you could support both tidyselect and the current notations. |
Right, the intention is to mimic the usage syntax, not the declaration syntax (frankly, Stan's declaration syntax is a bit convoluted owing to its C++ heritage; modern programming languages seem to avoid the terrible inside-out index declaration order that you get in C/C++, yet Stan adopted it). The usage syntax, which is sensible, is also the same syntax for variable usage in JAGS, and is the same syntax you see in the column names themselves in posterior matrices and data frames (and the output you get from
I like the idea of supporting a tidyselect interface with a function that could used in place of the symbolic specification for a variable. That would be an easy path forward that would also require less re-architecting of the thing, since variable spec parsing is already separate from all the rest of the logic of spread_draws/gather_draws. Is there an issue or something about the future plans for replacing the |
I think capturing expressions in functions like
spread_draws()
obscures the UI in tidybayes. For instance in:It makes sense that we are selecting
condition_mean
from the set of existing model parameters. But whilecondition_mean
selects a parameter,condition
on the other hand defines a new column.In general, it is best keep NSE purely for data-masking, so that all NSE interfaces share a consistent feel and it is easy for users to pick up new packages. That's why all the new functions in tidyr take a string to define new columns, rather than unquoted column names.
The text was updated successfully, but these errors were encountered: