freqTable: Univariate and bivariate frequency tables and barplots

Description Usage Arguments Value Examples

Description

freqTable builds an univariate or bivariate frequency table with counts and percentages at each combination of factor levels factor level and optionally shows a barplot.

Usage

1
2
3
freqTable(x, by = NULL, xlabel = NULL, bylabel = NULL, plot = TRUE,
  horizontal = FALSE, printFreq = TRUE, density = TRUE,
  showTable = TRUE, pctBycol = TRUE, title = "", digits = 2)

Arguments

x

variable to tabulate, which can be interpreted as factor

by

variable for crosstabulation, also interpreted as factor

xlabel

Label of the variable x, to be used in figures and tables.

bylabel

Label of the variable by, to be used in figures and tables.

plot

Logical. If TRUE a barplot is printed

horizontal

Logical. If TRUE bars are printed horizontally

printFreq

Logical. If TRUE frequency values are printed in the barplot

density

Logical. if TRUE barplot is printed with relative frequencies

showTable

Logical. If TRUE frequency table is printed via pander. If FALSE frequency table is returned invisibly.

pctBycol

Logical. If TRUE relative frequencies in crosstabs are computed by columns else by rows

Value

an univariate frequency table with absolute and relative frequencies, and optionally a barplot

Examples

1
2
3
4
symptom=sample(LETTERS[1:4],120,replace=TRUE)
disease=sample(c("Yes","No"),120,replace=TRUE)
freqTable(symptom,by=disease,horizontal=FALSE,density=TRUE,printFreq=TRUE,showTable=TRUE)
freqTable(symptom,horizontal=FALSE,density=TRUE,printFreq=TRUE,showTable=FALSE)

angeloSdP/ULPGCmisc documentation built on May 10, 2019, 11:47 a.m.