freqC | R Documentation |
Generates frequency distribution table and bar chart to describe distribution of variable values. Based on freq
function in descr package.
freqC(x, w, data, digits = 2, rowlabs, printC = FALSE, plot = TRUE, main,
xlab, ylab, bar.col, ...)
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. |
digits |
(Optional) Number of digits to display after decimal point (default=2). |
rowlabs |
(Optional) Vector specifying custom text for labeling table rows and chart bars. The rowlabs vector must correspond to x variable's levels (if the variable has five levels, rowlabs must be length 5). Useful when default value labels are too long. |
printC |
(Optional) Do you want to print frequency distribution table and bar chart (if plot is used) to .html file in working directory? (default: FALSE) |
plot |
(Optional) Do you want a bar chart? (default set to TRUE) |
main |
(Optional) Main title of bar chart. |
xlab |
(Optional) The x-axis label of bar chart. |
ylab |
(Optional) The y-axis label of bar chart. |
bar.col |
(Optional) The name of color to use for bars. Default is "gray80". |
... |
(Optional) Additional arguments passed to |
A frequency distribution table.
Make Frequency Distribution Tables and Bar Charts with RCPA3 Package's freqC Function 15:33
Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more.
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.
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.
library(RCPA3)
# unordered factors
freqC(x=region, data=world)
# ordered factors
freqC(x=threat.from.china, data=nes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.