Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

RCPA3 (version 1.3.1)

histC: Creates histogram to show distribution of interval (numeric) variable's values

Description

Generates frequency distribution table of binned values and a histogram to describe distribution of variable values.

Usage

histC(x, w, data, breaks, digits = 2, printC = FALSE, plot = TRUE, main,
  xlab, ylab, bar.col, ...)

Value

A frequency distribution table of binned x variable values.

Arguments

x

The variable to be analyzed. If dataset not specified with data argument, should be a vector in form dataset$var.

w

(Optional) Sample weights (must be numeric if used), If dataset not specified with data argument, should be in form dataset$weighvar

data

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

breaks

(Optional) Specify how to break the x variable into bins. Options include the number of breaks, a vector specifying the breakpoints, or the name of an algorithm that generates breakpoints. Default value is "Sturges" (other algorithms are "Scott" and "FD", see details in wtd.hist documentation).

digits

(Optional) Number of digits to display after decimal points (default is 2).

printC

(Optional) Do you want the histogram and binned frequencies table printed to working directory? (default: FALSE)

plot

(Optional) Do you want the histogram graphic? (default: TRUE)

main

(Optional) Customize main title for histogram.

xlab

(Optional) Custom label for x-axis of histogram.

ylab

(Optional) Custom label for y-axis of histogram.

bar.col

(Optional) Color for histogram bars; default is "gray80".

...

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

RCPA3 Package Tutorial Videos

Textbook References

  • Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapter 2.

  • Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 39-55. ISBN-13: 978-1506379616; ISBN-10: 150637961.

Online Resources

Examples

Run this code
   library(RCPA3)
   
   histC(x=states$covid.cases.per1000)
   

Run the code above in your browser using DataLab