histC {RCPA3} | R Documentation |
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, ...)
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 |
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 |
Value
A frequency distribution table of binned x variable values.
RCPA3 Package Tutorial Videos
-
Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more.
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
-
R Tutorials & Resources for Descriptive Statistics, Compiled by Barry C. Edwards
-
Sage Edge Resources for Political Analysis Series, for streaming videos, flashcards, and more student resources for textbooks by Pollock and Edwards, from Sage Publications.
-
Political Science Data Web Site: Find datasets for your own research and resources to help with the analysis.
Examples
library(RCPA3)
histC(x=states$covid.cases.per1000)