svydbhist: Histogram

Description Usage Arguments Author(s) See Also Examples

View source: R/svydbhist.R

Description

Histograms weighted by sampling weights.

Usage

1
2
svydbhist(x, design, binwidth = NULL, xlab = "x", ylab = "Density",
  ...)

Arguments

x

Name indicating the variable.

design

svydb.design object.

binwidth

The width of each bin. Binswidths are calculated with Sturges’ formula.

xlab, ylab

labels for xlab and ylab.

Author(s)

Charco Hui

See Also

svydbdesign, svydbmean

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(nhane)
nh.dbsurv = svydbdesign(st = SDMVSTRA, wt = WTMEC2YR, id = SDMVPSU, data = nhane)
svydbhist(x = DirectChol, design = nh.dbsurv)
svydbhist(x = DirectChol, design = nh.dbsurv, binwidth = 0.25)
svydbhist(x = Height, design = nh.dbsurv, xlab = "xx", ylab = "yy")
svydbhist(x = Weight, design = nh.dbsurv) + ggtitle("Weight")
# OR with a database connection
# library(MonetDBLite)
# library(DBI)
# library(dbplyr)
# con = dbConnect(MonetDBLite())
# dbWriteTable(con, "nhane", nhane)
# nhane.db = tbl(con, "nhane")
# nh.dbsurv = svydbdesign(st = SDMVSTRA, wt = WTMEC2YR, id = SDMVPSU, data = nhane.db)

chrk623/svydb documentation built on Oct. 6, 2019, 6:54 a.m.