# Missing values are always interpolated, i.e. assigned weight 0:
# Missing values are always interpolated, i.e. assigned weight 0; Similarly,
weights=weights*is.na(probs)
# ignore zero probabilities (cause problems with log)
weights=weights*(!is.na(probs)&(probs>0))
weights[is.na(weights)]=0
if(sum(probs>0,na.rm=TRUE)<d){
warning("Table '",table@name,"' does not have at least ",d," finite, non-zero probabilities. Unable to graduate. The original probabilities will be retained.")
return(table)
}
# Normalize the weights to sum 1
weights=weights/sum(weights)
# We cannot pass NA to whittaker, as this will result in all-NA graduated values.
# However, if prob==NA, then weight was already set to 0, anyway