wtd.mode {RCPA3} | R Documentation |
Find Mode of Variable with Option to Weight Observations
Description
Takes in variable and finds mode, works with sampling weights. Makes use of the freq function, part of the descr package.
Usage
wtd.mode(x, w, data, ...)
Arguments
x |
A variable |
w |
(Optional) Sampling weights of variable |
data |
(Optional) A dataset |
... |
(Optional) Additional arguments pass to descr::freq function |
Value
Returns the modal value(s) of the variable, if mode exists
Examples
library(RCPA3)
wtd.mode(x=nes$angry.about.things, w=nes$wt)
wtd.mode(x=nes$angry.about.things)
wtd.mode(x=nes$discrim.vs.men, w=nes$wt)
wtd.mode(x=nes$discrim.vs.men)
[Package RCPA3 version 1.3.1 Index]