-
Notifications
You must be signed in to change notification settings - Fork 27
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
Allow cur_svy()
to work inside mutate()
?
#138
Comments
Yeah that makes sense. I just hadn’t thought of a situation where you’d want the survey context set in a mutate, maybe needs it for all dplyr verbs (filtering by weights too?) |
Filtering by comparing to the mean in a single step is probably a more likely situation |
Thanks, Greg. That's a good common example. Another more specialized reason for filtering on the weights is doing diagnostics of nonresponse adjustments. For example, you might want to look at cases where the adjusted weights are much different than the original weights. Or you might want to look at cases with especially large or small weights so that you can trim them to try to reduce variances. Do you think it would make sense to add context for |
Yep, makes sense! Thanks! I think it’s as simple as adding two lines like this, but I may be forgetting something |
I just ran into this today. I was trying to figure out how many missing values there were for the group with non-zero weights so I tried to use I logged on to GitHub to see if there were any open issues on it just to find that you guys are already on top of it! |
@bschneidr - did you get a chance to work on this? I'm hoping for some time to look at srvyr in the next week or two, would be nice to get this in the release. Happy to take a look myself if you haven't. |
Yep, sorry for the delayed reply @gergness. I had to take some time off of open-source work the last few weeks but finally have time now to work on this. |
closed via #139 |
I'm working on a pull request to try and implement the
cur_svy_wts()
function suggested in #136, and as a result I noticed thatcur_svy()
works insidesummarize.tbl_svy()
but not insidemutate.tbl_svy()
.Created on 2021-12-19 by the reprex package (v2.0.0)
Is there a design reason why
cur_svy()
isn't supported insidemutate()
? If not, I'm happy to see if we can get it to work.The text was updated successfully, but these errors were encountered: