Description Usage Arguments Note See Also

View source: R/2statsHelpers.R

Computes a weighted median of a numeric vector.

1 2 3 |

`x` |
a numeric vector containing the values whose weighted median is to be computed. |

`w` |
a vector of weights the same length as x giving the weights to use for each element of x. Negative weights are treated as zero weights. Default value is equal weight to all values.# |

`na.rm` |
a logical value indicating whether NA values in x should be stripped before the computation proceeds, or not. If NA, no check at all for NAs is done. Default value is NA (for efficiency). |

`interpolate` |
If TRUE, linear interpolation is used to get a consistent estimate of the weighted median. |

`ties` |
If interpolate == FALSE, a character string specifying how to solve ties between two x's that are satisfying the weighted median criteria. Note that at most two values can satisfy the criteria. When ties is "min", the smaller value of the two is returned and when it is "max", the larger value is returned. If ties is "mean", the mean of the two values is returned and if it is "both", both values are returned. Finally, if ties is "weighted" (or NULL) a weighted average of the two are returned, where the weights are weights of all values x[i] <= x[k] and x[i] >= x[k], respectively. |

`method` |
If "shell", then order() is used and when method="quick", then internal qsort() is used. |

`...` |
Not used. |

This function is a duplicate from
`weightedMedian`

in the
aroma.light package

Other "central tendency functions":
`weightedCount`

, `weightedMean`

,
`weightedSum`

Other stats helper functions: `allNA`

,
`allNull`

, `is.yesno`

,
`qType`

, `reorderQuestion`

,
`reorderResponse`

,
`splitBinCombine`

,
`splitMeanCombine`

,
`splitPercentCombine`

,
`weightedCount`

, `weightedMean`

,
`weightedSum`

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.