describe() gives wrong NA percentage
Closed this issue · 1 comments
gdutz commented
The describe()-function shows the wrong percentage of NAs in its upper part (the values in the table are fine).
Example:
df <- data.frame(matrix(NA, nrow = 1000, ncol = 1))
df[1:100, 1] <- 1
df2[101:200, 1] <- 2
We now have a dataframe with 80% missing cases. However, describe() shows 0.8%. I think you need that to multiply by 100 ;-)
questionr::describe(df[[1]])
results in:
[1000 obs.]
numeric: 1 1 1 1 1 1 1 1 1 1 ...
min: 1 - max: 2 - NAs: 800 (0.8%) - 3 unique values
n % val%
1 100 10 50
2 100 10 50
NA 800 80 NA
Total 1000 100 100
I'll try to send you a pull request.
juba commented
PR merged. Thanks for the detailed issue and the pull request !