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.")
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.")