Learn R Programming

poliscidata (version 2.3.0)

xtp: Cross tabulation Analysis

Description

Generates cross-tabulation of dependent and indendent variables, also creates a mosiac plot. Makes use of the crosstab function in the descr package.

Usage

xtp(
  data,
  y,
  x,
  w = NULL,
  ylab = NULL,
  xlab = NULL,
  main = NULL,
  digits = 2,
  chisq = FALSE
)

Arguments

data

Dataset (like gss, nes, states, or world)

y

Dependent variable

x

Independent variable

w

Weights (optional)

ylab

Y-axis label (optional)

xlab

X-axis label (optional)

main

Main label for plot (optional)

digits

Number of digits to report after decimal place, optional (default = 2)

chisq

Do you want Chi-Squared test reported? (default is FALSE)

Value

A data frame of the cross tabulation results

Examples

Run this code
# NOT RUN {
   library(poliscidata)
   
   xtp(gss, grass, attend3, wtss)
# }

Run the code above in your browser using DataLab