View source: R/proficiency_tools.R
crosstabs | R Documentation |
Build a list of crosstabulations from a dataset
crosstabs(data, rowvar, colvar, varnames, digits = 2)
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 |
a list with crosstab calculations
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.