View source: R/helper.functions.r
wtd.mode | R Documentation |
Takes in variable and finds mode, works with sampling weights. Makes use of the freq function, part of the descr package.
wtd.mode(x, w, data, ...)
x |
A variable |
w |
(Optional) Sampling weights of variable |
data |
(Optional) A dataset |
... |
(Optional) Additional arguments pass to descr::freq function |
Returns the modal value(s) of the variable, if mode exists
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.