Learn R Programming

RCPA3 (version 1.3.1)

wtd.hist: Creates a Histogram Showing Distribution of Variable Values With Option for Weights Makes use of the wtd.hist function, part of the weights package.

Description

Takes in variable and generates histogram plot to show the distribution of its values, works with sampling weights. The wtd.hist function is imported from the weights package. See wtd.stats documentation for details.

Usage

wtd.hist(x, w = NULL, data, breaks, ...)

Value

Generate a histogram plot.

Arguments

x

A variable (must be numeric), should be in dataset$var form unless dataset specified in optional data argument.

w

Sampling weights of variable (optional), must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument.

data

(Optional) Name of dataset that contains x (and w) variable.

breaks

(Optional) Specifies the breakpoints between bins of the histogram. See wtd.hist documentation for details.

...

(Optional) Additional arguments passed to weights::wtd.hist function.

Examples

Run this code
   library(RCPA3)
   
   wtd.hist(x=nes$age, w=nes$wt)

Run the code above in your browser using DataLab