Skip to content
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

weighted.median(NA, na.rm=T) returns logical(0), expected NA_real_ #32

Open
danielkrizian opened this issue Nov 6, 2014 · 0 comments
Open

Comments

@danielkrizian
Copy link

I'd propose that weighted.median function returns NA_real_ instead of logical(0), when all x are NAs:

weighted.median(NA, 1, na.rm=T) # returns `logical(0)`

The problem with logical(0) output is that calculating weighted mean summaries by group causes an error when using dplyr::group_by and dplyr::summarise

  ## Column 2 of result for group 2 is type 'double' but expecting type 'logical'. Column types must be consistent for each group. 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant