Learn R Programming

RCPA3 (version 1.3.1)

wtd.mode: 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, ...)

Value

Returns the modal value(s) of the variable, if mode exists

Arguments

x

A variable

w

(Optional) Sampling weights of variable

data

(Optional) A dataset

...

(Optional) Additional arguments pass to descr::freq function

Examples

Run this code
   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)

Run the code above in your browser using DataLab