count two columns as a cross-tabulation table
cross_count(df, row, col, method = "n", digits = 2)
data.frame
tibble
the column as rownames in the output
the column as colnames in the output
one of n|count, rowr|row_ratio, colr|col_ratio
the digits of ratios
cross_count(mini_diamond, cut, clarity)
# show the ratio in the row
cross_count(mini_diamond, cut, clarity, method = "rowr")
# show the ratio in the col
cross_count(mini_diamond, cut, clarity, method = "colr")
Run the code above in your browser using DataLab