Learn R Programming

vannstats (version 1.5.1.8)

tab: Simplified Crosstabs

Description

This function returns a crosstab (tab) on a given data frame, and using simplified calls within the function for two variables, to return the observed and expected frequencies.

Usage

tab(df, var1, var2)

Value

This function returns the observed and expected frequencies of a bivariate relationship between var1 and var2 in data frame df.

Arguments

df

data frame to read in.

var1

a first grouping variable.

var2

a second grouping variable.

Examples

Run this code
data <- mtcars

tab(data,mpg,cyl)

Run the code above in your browser using DataLab