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

[DataSummary]Weighted Mean Values are not correct when including NA #49

Closed
SixiangHu opened this issue Jul 18, 2018 · 0 comments
Closed
Assignees
Labels

Comments

@SixiangHu
Copy link
Owner

SixiangHu commented Jul 18, 2018

test = data.frame(a = c(1,NA),b = c(1,1))
DataSummary(test)

VarName VarType Unique Missing Missing_pct Mean Min Max Entropy
1: a numeric 2 1 0.5 0.5 1 1 0
2: b numeric 1 0 0.0 1 1 1 0

It is related to:
https://github.com/SixiangHu/DataMan/blob/master/R/DataSummary.R#L75

That when x include NAs, the sum of weighted is less than sum(weight,na.rm=TRUE) because there is no NA in weight.

SixiangHu added a commit that referenced this issue Jul 18, 2018
@SixiangHu SixiangHu self-assigned this Jul 18, 2018
@SixiangHu SixiangHu added the bug label Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant