Comments (10)
mutate_variables
is now supported as well.
x <- as_draws_df(example_draws())
x <- subset(x, variable = c("mu", "tau"))
mutate_variables(x, tau2 = tau^2)
mutate_variables(x, scale = 1.96 * tau, lower = mu - scale)
from posterior.
Should we wish to use tidyverse-style NSE I believe the only dependency we need is rlang
, which itself has no other dependencies (and which we already have a dependency on via tibble
).
I don't think we would need to support more complex syntax available in select()
(things like starts_with()
, one_of()
, etc), which would require a dependency on tidyselect
, which itself has some other dependencies I don't think we already have (glue
and purrr
).
So supporting tidyverse NSE should in effect add no new dependencies (rlang
would move from being an indirect to a direct dependency).
from posterior.
Should we wish to use tidyverse-style NSE I believe the only dependency we need is
rlang
Yeah I think you're right that rlang
is the only dependency we'd need for that. In my experience working with rlang
a bit (although not a ton) I've found it to be super cool but also quite confusing. If I'm not using it consistently then every time I come back to it I have to reteach myself what everything means! Anyway, that doesn't mean we shouldn't use it, just that it could make our code base inaccessible to anyone who doesn't want to do a deep dive into rlang
(which is probably most people). That's one of the annoying things about a lot of the source code for the tidyverse (not trying to criticize and it's probably unavoidable for them, but still unfortunate). Of course if we're just using it for a few things then that's no big deal and also probably worth it even if we use it a lot because it allows for nice features. Anyway, just thinking out loud.
from posterior.
Having the rlang
dependency` is fine for me but I don't have much experience with its NSE semantics. @mjskay you presumably know how it works, right?
from posterior.
Yeah, I've used rlang
's NSE stuff. It is largely a matter of adopt eval_tidy
and/or quo
instead of eval
and quote
; those functions resolve the tidyverse quasiquotation syntax for you (e.g. !!x
or {{ x }}
for substituting expressions). rename_variables
would be relatively straightforward I think. mutate_variables
might be more of a pain as I think it would require some format-specific verification that the result of the mutate can actually be stored in the format being used.
If we want this I can take a stab at it.
from posterior.
Thank you! I think it is a nice feature that people will ask for and I would be happy if you could take a shot at it. Perhaps starting with the draw_df
class where things should be easier than for the other formats.
from posterior.
Same! Happy for you to take a stab at it, thanks! It does seem like a nice feature to offer.
from posterior.
Just a quick note that I am working on mutate_variables
now.
from posterior.
Cool! One small thing from testthat:
test-mutate_variables.R:13: warning: mutate_variables works correctly for draws_df objects
Using `as.character()` on a quosure is deprecated as of rlang 0.3.0.
Please use `as_label()` or `as_name()` instead.
from posterior.
Thanks. Should be fixed now.
from posterior.
Related Issues (20)
- Speed up broadcast_and_bind_rvars()
- Single ESS value as min(ess_bulk, ess_tail) HOT 4
- rhat.list and rhat.matrix return different values HOT 2
- mcse for minimum / maximum HOT 1
- `rvar` conversion drops dimensions HOT 2
- Adjust rvar S4 class definition HOT 3
- Breakage due to dplyr 1.10.0 HOT 4
- Control Variates HOT 32
- function analogous to across in dplyr? HOT 5
- Strange output and content after `as.data.frame()` coercion HOT 5
- Add convergence methods for draws objects HOT 19
- How to not repair .chain / .iteration / .draw indices? HOT 1
- [Feature] Add relative_eff function HOT 1
- [feature] set_variable_names (alias of variables<-) for piping HOT 3
- Subsetting an rvar with an rvar HOT 11
- summarise_draws still prohibitively slow for very large models HOT 12
- rfun does not work with primitive functions HOT 1
- rfun does not work with formulas HOT 3
- Problem with str() and rvars that have only a single draw HOT 4
- Still seeing formatting problems with summarise_draws HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from posterior.