gergness / srvyr

R package to add 'dplyr'-like Syntax for Summary Statistics of Survey Data
214 stars 28 forks source link

Should `survey_mean()` warn when passed `na.rm` and no `x` arg #177

Closed gergness closed 3 months ago

gergness commented 4 months ago

In the past I think I've been against this, but can't find if we've discussed it before. This is probably the most common reported issue.

Ben improved documentation in #161, which isn't on CRAN yet, but documentation never felt like quite enough to me.

I think my main argument for not warning has been because I reflexively add na.rm=TRUE, so would be annoyed by this warning. But tidyverse has good precedent for warning once per session (and maybe even less frequently), and we could allow turning it off or something, so I'm kind of leaning towards adding it now.

Thoughts @bschneidr @szimmer or anyone else following along?

bschneidr commented 3 months ago

Thanks, @gergness, I like this change. The confusion about the underlying behavior just comes up so often, that I think it's worth having this once-per-session warning when users try using the na.rm = TRUE functionality for proportions with survey_mean().