wtd.mode: Find Mode of Variable with Option to Weight Observations

View source: R/helper.functions.r

wtd.modeR 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)

RCPA3 documentation built on May 29, 2024, 12:19 p.m.

Related to wtd.mode in RCPA3...