crosstabs {eeptools}R Documentation

Build a list of crosstabulations from a dataset

Description

Build a list of crosstabulations from a dataset

Usage

crosstabs(data, rowvar, colvar, varnames, digits = 2)

Arguments

data

a data object, matrix or dataframe, that contains the categorical variables to compose the crosstab

rowvar

a character value for the column in data that will be displayed on the rows of the crosstab

colvar

a character value for the column in data that will be displayed in columns of the crosstab

varnames

a character vector of length two with the labels for rowvar and colvar respectively

digits

an integer for how much to round the proportion calculations by, default is 2

Value

a list with crosstab calculations

Examples

df<-data.frame(cbind(x=seq(1,3,by=1), y=sample(LETTERS[6:8],60,replace=TRUE)),
fac=sample(LETTERS[1:4], 60, replace=TRUE))
varnames<-c('Quality','Grade')
myCT <- crosstabs(df, rowvar = "x",colvar = "fac", varnames = varnames, digits =2)

[Package eeptools version 1.2.5 Index]