-
Notifications
You must be signed in to change notification settings - Fork 34
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
SPEEDUP: weighted*() functions allocate 'w' to ones if missing #22
Comments
DECISION:
|
values rather than missing(w) [#22]
Actually, let's go with |
of cause it's your decision..... but not using |
My main concern with For example, using (say) if (!useWeights) w <- NULL
foo(..., w=w) This is also backward compatible with how Without such a place holder and instead using
With several arguments, I have to cover all permutation, or use: args <- list(..., w=w)
if (!useWeights) args$w <- NULL
do.call(foo, args) ... or is there another way? |
Hi. I commented to this effect here: https://github.com/HenrikBengtsson/Wishlist-for-R/wiki But you can specify it programmatically. Just do
|
Thanks @gmbecker; first I though "interesting; how did I not know about this one", but then I realized I do (see my Sept 14 comment above) - so, as usual, bad memory on my end. Your comment made me help clarify what I'm exactly looking for; a way to explicitly pass a value such that it is interpreted as missing, e.g. if (miss) w <- missing() else w <- 1
foo(w=w) Currently, the only way this can be done is as: if (miss)
foo(w=)
else
foo(w=1) This becomes unwieldy when there are many arguments that may need to be passed as missing. I'm looking for a solution where I call |
The
weightedMad()
andweightedVar()
usedand
weightedMedian()
lets the argument default as:This is (a) inconsistent, but also (b) inefficient. It's better to avoid allocate an n-vector of ones and instead call the non-weighted estimator.
PS. The
weightedMean()
function requires 'w' to be given.The text was updated successfully, but these errors were encountered: