harrelfe / Hmisc

Harrell Miscellaneous
Other
205 stars 81 forks source link

NAs in weights #91

Closed Stefan2015-5 closed 6 years ago

Stefan2015-5 commented 6 years ago

if any element of the weight vector is NA, wtd.quantile returns Error in if (any(i)) { : missing value where TRUE/FALSE needed which is not particularly telling.

You might want to include sth like: if(any(is.na(weights) & !is.na( x ))) stop("At least one weight is NA.")

harrelfe commented 6 years ago

I decided to just remove observations with is.na(weights) like I do for the other wtd.* functions