freqC {RCPA3}R Documentation

Reports the frequency distribution of dataset variable with table and bar chart

Description

Generates frequency distribution table and bar chart to describe distribution of variable values. Based on freq function in descr package.

Usage

freqC(x, w, data, digits = 2, rowlabs, 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.

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 descr::freq function.

Value

A frequency distribution table.

RCPA3 Package Tutorial Videos

Textbook References

Online Resources

Examples

   library(RCPA3)
   
   # unordered factors
   freqC(x=region, data=world)
   
   # ordered factors
   freqC(x=threat.from.china, data=nes)

[Package RCPA3 version 1.2.1 Index]