This function is deprecated, use tabyl(dat, var1, var2)
instead.
crosstab(...)# S3 method for default
crosstab(vec1, vec2, percent = "none",
show_na = TRUE, ...)
# S3 method for data.frame
crosstab(.data, ...)
additional arguments, if calling crosstab
on a data.frame.
the vector to place on the crosstab column. If supplying a data.frame, this should be an unquoted column name.
the vector to place on the crosstab row. If supplying a data.frame, this should be an unquoted column name.
which grouping to use for percentages, if desired (defaults to "none", which returns simple counts). Must be one of "none", "row", "col", or "all".
a logical value indicating whether counts should be displayed where either variable is NA
.
(optional) a data.frame, in which case vec1
and vec2
should be unquoted column names.
Returns a data.frame with the frequencies of the crosstabulated variables.