gghistweight: Weighted Histogram

View source: R/histograms.R

gghistweightR Documentation

Weighted Histogram

Description

In ggsurvey you specify both the plotting variables and weights in plain text with no quotes.

Usage

gghistweight(df, x, weights, binwidth = NULL)

Arguments

df

data frame

x

variable of interest

weights

survey weights that sum to sample size

binwidth

desired binwidth, if NULL bins in geom_histogram defaults to 30

Value

ggplot object

Examples

library(survey)
data(api)
gghistweight(apistrat, api00, pw)
gghistweight(apistrat, api00, pw, binwidth = 10)
data(election)
gghistweight(election_pps, Bush, p)

balexanderstats/ggsurvey documentation built on May 12, 2022, 2:22 p.m.